Skip to content

Payment Process

During the payment process, the user performs the following actions:

  • selects a payment method;
  • makes the payment using the chosen method;
  • confirms the payment if necessary.

Payment Creation

Payment is the main entity of the Epicsplat API for accepting payments. To create a payment, you need to include in the request:

  • authentication data;
  • platform data;
  • payment amount and currency;
  • customer data;
  • payment hash.

Example request for creating a payment [API Reference]

curl https://api.epicsplat.com/paysystem/v1/orders/ \
    -X POST \
    -H 'Content-Type: application/json'
    -H "Authorization: Bearer <token>"
    -d '{
        "shop_id": 94311,
        "shop_internal_id": "myshop.example/order.2222",
        "merchant_customer": {
            "uid": "myshop.example/customer.1111",
            "phone_number": "+79999999999",
            "email": "customer@example.com",
            "card_number": "4444444444444444"
        },
        "fiat_amount": 100,
        "fiat_currency": 1,
        "success_redirect_url": "https://example.com/success",
        "fail_redirect_url": "https://example.com/fail",
        "hash": "<hash>"
    }'
Field Description
Field Description
shop_id Platform ID
shop_internal_id Internal order ID in the shop's accounting system
merchant_customer Customer data
merchant_customer.uid Unique customer ID in the shop's accounting system
merchant_customer.phone_number Customer's phone number
merchant_customer.email Customer's email
merchant_customer.card_number Customer's card number
fiat_amount Payment amount in the fiat_currency currency
fiat_currency Payment currency
hash Hash string signed with secret1. More about hash formation

Example of a created payment object

{
    "order_id": 801633,
    "paywall": "https://paywall.epicsplat.com/#/paywall/801633/"
}
Field Description
Field Description
order_id Order ID for payment
paywall Payment page link

Creating a hash for a new payment

Each payment initiation request must be signed using the md5 method. To create the string for hashing, use the following format:

<shop_id>;<fiat_amount>;<fiat_currency>;<shop_internal_id>;<seret1>

Field Description
Field Description
shop_id Platform ID
fiat_amount Payment amount in the fiat_currency currency. According to the established rules, all trailing zeros should be removed. In the case of an integer, the fractional part should be excluded.

For example: when converting the number 100.0, the result should be 100, and for the number 100.01, the result will be 100.01
fiat_currency Payment currency
shop_internal_id Internal order ID in the shop's accounting system
secret1 Secret key secret1 issued for each platform upon creation. It can be reissued if necessary

Security

Secret key secret1 is a crucial element for ensuring the security of your data. It is recommended to store it securely and maintain confidentiality, not disclosing it on third-party resources.

Payment Confirmation

User Redirection

Upon completing the payment process, the user will be automatically redirected to the specified addresses:

  • In case of successful payment - success_redirect_url
  • In case of payment error - fail_redirect_url

The payment data will be added to the specified URLs as a query string.

Example query string

order_id=801633&shop_id=0&customer_id=myshop.example%2Fcustomer.123&shop_internal_id=myshop.example%2Forder.123&amount=100&currency=100&is_success=True&hash=<hash>

HTTP Callback

The HTTP Callback address is specified in the platform settings. Upon payment results, an HTTP POST request with data in JSON format will be sent to the specified address.

Example body after successful payment:

{
    "order_id": 801633,
    "shop_id": 94311,
    "customer_id": "myshop.example/customer.1111",
    "shop_internal_id": "myshop.example/order.2222",
    "amount": 100,
    "currency": 1,
    "is_success": true,
    "hash": "<hash>"
}

Field Description
Field Description
order_id Order ID
shop_id Platform ID
customer_id Unique customer ID in the shop's accounting system
shop_internal_id Internal order ID in the shop's accounting system
amount Payment amount in the currency currency
currency Payment currency
is_success Payment was successful
hash Hash string for authenticity verification. More about hash verification

Authenticity Verification of Payment Results

Upon receiving payment information, it is necessary to verify the authenticity of the transmitted data. Along with the payment data, a hash will be transmitted. It is important to create the hash independently and compare it with the value in the request. To create the string for subsequent hashing using the md5 algorithm, follow a specific format:

<amount>;<currency>;<customer_id>;<is_success>;<order_id>;<shop_id>;<shop_internal_id>;<secret2>