Create a Checkout Session
Add an endpoint on your server that creates a Checkout session. A Checkout session controls the information your customer can see on the payment page, such as the order amount and currency, as well as the accepted payment methods.The endpoint to use is
POST https://buy.api.yabetoopay.com/v1/sessions
.Define a Product to Sell
Always store sensitive information about your product inventory (such as price, availability, etc.) on your server to prevent any customer from modifying it. Define your product details when creating the Checkout session.Define Metadata (optional)
You can add metadata to your Checkout session to store additional information, such as the order ID, customer ID, and more.Provide Success and Cancel URLs
Provide success and cancel URLs to redirect your customer back to your website after the payment. These URLs are used to inform the customer about the status of the transaction and to perform additional actions on your server, such as updating the order status.Full exemple
The following example shows how to create a Checkout session with all the required parameters.Response
The response contains the session ID and other details.Redirect to Checkout
Once the Checkout session is created, redirect your customer to the hosted payment page URL. This URL is available in the Checkout session response.Redirect the Customer
Once the payment is completed, the customer is redirected to the success or cancel URL you specified in thesuccessUrl
or cancelUrl
field.
Our system will add the transaction ID to your callback like this: https://your_callback?paymentId={id}
. It is in your interest to verify the correct receipt of the payment by checking the status of the transaction in our system by following this process:
Sandbox :
https://pay.sandbox.yabetoopay.com/v1/payment-intents/{paymentId}
Production :
https://pay.api.yabetoopay.com/v1/payment-intents/{paymentId}
Why Perform a Double Verification?
- Security : Ensures that the payment was genuinely made and that you do not process false transactions.
- Confidence : By formally verifying the payment status via the API, you maintain a reliable record of successful and failed transactions.
- Prevention of fraud : By verifying the payment status, you reduce the risk of potential fraud.