Server-side payment initialization

Payment initialization on the server-side


The server-side payment initialization makes it possible to integrate a Checkout Form into your website or game client using PaySuper API. It’s easy to get a Checkout Form URL using an Order API request and render a payment form in a browser.

You can use PaySuper JS SDK for the client-side payment initialization to integrate a Checkout Form into your website only on the client-side.


Step 1. Create a Checkout order on your server

Send the POST /api/v1/order to receive an Order ID. Learn more about the full list of parameters that can be used for instance the redirect URLs for successful and failed payments.

Simple Checkout

To initiate simple checkout payments it’s enough to create a payment order with your Project ID and an acceptable amount and currency.

Use this sample code to create an Order ID with the required parameters for a simple checkout:

Run the script and view the response data:

Or try it with cURL to interact with the API over HTTP from your console:

curl -X POST -H 'Content-Type: application/json' -d '{
    "project": "YOUR_PROJECT_ID",
    "amount": 10,
    "currency": "USD",
    "type": "simple"
}' 'https://checkout.pay.super.com/api/v1/order'
Remember to use your IDs for the project and products. You can find your IDs in your merchant account on the PaySuper Projects. Open your Project settings page, select the Product tab and click on the Product name. Copy the Project and Product IDs from the page URL.

Products Checkout

If you’re selling products such as key-activated products, virtual items or in-game currency, you can use this sample code with a defined product parameter:

Run the script and view the response data:

Or try it with cURL to interact with the API over HTTP from your console:

curl -X POST -H 'Content-Type: application/json' -d '{
    "project": "YOUR_PROJECT_ID",
    "products": ["YOUR_GAME_KEY_ID"],
    "type": "key"
}' 'https://checkout.pay.super.com/api/v1/order'

Run the script and view the response data:

Or try it with cURL to interact with the API over HTTP from your console:

curl -X POST -H 'Content-Type: application/json' -d '{
    "project": "YOUR_PROJECT_ID",
    "products": ["YOUR_VIRTUAL_ITEM_ID_1", "YOUR_VIRTUAL_ITEM_ID_2"],
    "type": "product"
}' 'https://checkout.pay.super.com/api/v1/order'

Run the script and view the response data:

Or try it with cURL to interact with the API over HTTP from your console:

curl -X POST -H 'Content-Type: application/json' -d '{
    "project": "YOUR_PROJECT_ID",
    "products": ["YOUR_VIRTUAL_ITEM_ID_1"],
    "type": "product"
}' 'https://checkout.pay.super.com/api/v1/order'

Step 2. Display a Checkout Form

Retrieve the response parameter payment_form_url from the previous step. It is the URL of a PaySuper-hosted payment form.

When your customer is ready to start a payment you can redirect the user to the URL in a new browser window.

Retrieve the response parameter payment_form_url from the previous step. It is the URL of a PaySuper-hosted payment form.

Embed the Checkout Form as an inline iframe by URL:

<iframe src="{payment_form_url}"></iframe>

Retrieve the response parameter with id from the previous step. It is the ID of the created order.

Use this code sample to open the Checkout Form as a standalone web-page with PaySuper JS SDK and replace YOUR_ORDER_ID in the formUrl with id value:

<script>
function buyItems() {
    const paySuper = new PaySuper({
        formUrl: 'https://order.pay.super.com/?order_id=YOUR_ORDER_ID'
    });

    paySuper.renderPage();
}
</script>

<button onclick="buyItems()">BUY</button>

Next steps

After the payment

After a successful payment, you have to fulfil the customer’s purchase. You can use webhooks or the Transactions to accomplish the purchase.

Testing the Checkout

Verify that your integration with PaySuper Checkout works correctly. Our offered test cards can be used to create payments that produce defined responses for you to test your integration code.

Customizing the Checkout

Learn about the different ways you can customize your Checkout.


Questions?

Sales

Our salespeople are pleasant and friendly. Leave your contact details, and we’ll be back to you in no time.

Support

We are always happy to help with a code, improve a guide or consider a feature.

GitHub

The PaySuper Checkout Form, the JS SDK and even the server are available as a source code on our GitHub. You’re welcome to explore the code and help us make PaySuper even better.


Not a developer?

Our engineers will help you integrate PaySuper into your existing e-commerce platform, a website or a game in the best possible way. If you want something very special and crazy custom yet don’t have a suitable programmer available nearby - talk to us! We won’t let down a PaySuper user. We will try to help you in every possible way. We can even hire a programmer for you!