Give Pay Documentation
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:

PropertyTypeDescription
namestringName of the item
quantitynumberQuantity (must be greater than 0)
amountnumberPrice in smallest currency unit, e.g., cents (must be greater than 0)
country_isostring (optional)ISO 3166-1 alpha-2 country code (e.g., "GB")
intentionstring (optional)The intention or purpose of the payment (e.g., "General Donation")
projectstring (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:

PropertyTypeDescription
emailstringValid email address of the payer
first_namestring (optional)First name of the payer
last_namestring (optional)Last name of the payer
phonestring (optional)Phone number of the payer
billing_addressobject (optional)Billing address details

billing_address is an object that contains the following properties:

PropertyTypeDescription
countrystring (optional)ISO 3166-1 alpha-2 country code (e.g., "GB")
citystring (optional)City name
line1string (optional)Address line 1
line2string (optional)Address line 2
postcodestring (optional)Postal code
statestring (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:

CurrencyUnitExample for $50
USDCents5000
EURCents5000
GBPPence5000
JPYYen50 (no decimals)