TypeScript SDK

decodePayment

Decodes a base64 encoded payment string back into a PaymentPayload object

function decodePayment(payment: string): {
network: string;
payload:
| {
authorization: {
from: string;
nonce: string;
to: string;
validAfter: string;
validBefore: string;
value: string;
};
signature: string;
}
| { transaction: string };
scheme: "exact";
x402Version: number;
};

Parameters

The base64 encoded payment string to decode

Type

let payment: string;

Returns

let returnType: {
network: string;
payload:
| {
authorization: {
from: string;
nonce: string;
to: string;
validAfter: string;
validBefore: string;
value: string;
};
signature: string;
}
| { transaction: string };
scheme: "exact";
x402Version: number;
};

The decoded and validated PaymentPayload object