JavaScript SDK
Create Payment Session
Reference for payment options and configuration
Payment Options Reference
When calling renderButton(), you must provide a payment options object with the following properties:
Required Properties
currency (string, required)
The three-letter ISO currency code (e.g., 'USD', 'EUR', 'GBP').
currency: "USD";line_items (array, required)
An array of items being purchased. Each item must include:
| Property | Type | Description |
|---|---|---|
name | string | Name of the item |
quantity | number | Quantity (must be greater than 0) |
amount | number | Price in smallest currency unit, e.g., cents (must be greater than 0) |
country_iso | string (optional) | ISO 3166-1 alpha-2 country code (e.g., "GB") |
intention | string (optional) | The intention or purpose of the payment (e.g., "General Donation") |
project | string (optional) | The specific project the payment is for (e.g., "Winter Appeal 2024") |
line_items: [
{
name: "Winter Appeal 2024",
quantity: 1,
amount: 9900, // $99.00
country_iso: "GB",
intention: "General Donation",
project: "Winter Appeal 2024"
},
];payer (object, required)
Information about the customer making the payment:
| Property | Type | Description |
|---|---|---|
email | string | Valid email address of the payer |
first_name | string (optional) | First name of the payer |
last_name | string (optional) | Last name of the payer |
phone | string (optional) | Phone number of the payer |
billing_address | object (optional) | Billing address details |
billing_address is an object that contains the following properties:
| Property | Type | Description |
|---|---|---|
country | string (optional) | ISO 3166-1 alpha-2 country code (e.g., "GB") |
city | string (optional) | City name |
line1 | string (optional) | Address line 1 |
line2 | string (optional) | Address line 2 |
postcode | string (optional) | Postal code |
state | string (optional) | State or province |
payer: {
email: "john.doe@example.com",
first_name: "John",
last_name: "Doe",
phone: "+447700900000",
billing_address: {
country: "GB",
city: "London",
line1: "123 Main Street",
line2: "Flat 4",
postcode: "SW1A 1AA",
state: "Greater London"
}
}return_url (string, required)
The URL where the customer will be redirected after completing or canceling the payment.
return_url: "https://yoursite.com/payment/success";Complete Payment Options Example
{
currency: 'USD',
line_items: [
{
name: 'Product 1',
quantity: 2,
amount: 2500 // $25.00 each
},
{
name: 'Product 2',
quantity: 1,
amount: 5000 // $50.00
}
],
payer: {
email: 'customer@example.com'
},
return_url: 'https://yoursite.com/checkout/complete'
}Currency Format
All amounts in amount should be in the smallest currency unit:
| Currency | Unit | Example for $50 |
|---|---|---|
| USD | Cents | 5000 |
| EUR | Cents | 5000 |
| GBP | Pence | 5000 |
| JPY | Yen | 50 (no decimals) |