Create a customer
Before creating a Payment Session, you need a customer to associate the payment with. You can either use an existing customer or create a new one using the Customers API.Create a customer
Customer object
Create a Payment Session
To create a Payment Session, you need to specify theamount, currency, customer, mode, and payment_method_types. You can optionally include a return_url to redirect customers after the payment is completed.
Create a Payment Session
url parameter.
Payment Session object
Supported payment method types
You can accept payments using the following payment method types:Share the Payment Session URL
After creating a Payment Session, share theurl with your customer. They will be guided through a secure flow to complete the payment. Once complete, they will be redirected to your return_url.
You can also set send_email to true to automatically send the URL to the customer’s email address.
Send email to customer
Optional parameters
Reporting type
Use thereporting_type parameter to categorize the payment for reporting purposes. Defaults to charge.
Payment Session with reporting type
Transaction data
Use thetransaction_data parameter to configure how the resulting transaction should be processed, including transfer behavior and customer balance options.
Payment Session with transaction data
Retrieve a Payment Session
You can retrieve a Payment Session to check its status and see the associated transaction.Retrieve a Payment Session
status field will change to paid and the transaction field will contain the ID of the created transaction.
Completed Payment Session
Cancel a Payment Session
You can cancel a Payment Session if it is no longer needed.Cancel a Payment Session