Create payment

The Create payment method is used for creating a payment for topping up the balance of an account of the current reseller or any of its downstream resellers.

An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating Manager's information

The manager's API token specified in an API request determines:

  • The role and access level of the manager, which determine the availability of a method.
  • The current reseller and downstream resellers accessible within a method.

POST {base_url}/api/v3/resellers/{reseller_id}/payments
{
    "data":
    {
        "attributes":
        {
            "account_id": {account_id},
            "total": {amount_of_payment},
            "comment": "{comment}",
            "purpose": "{payment_purpose}"
        }
    }
      
}

Arguments

Name

Parameter Type

Data type

Required/ Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating Manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathnumberRequiredID of the current reseller or any of its downstream resellers (see Viewing and updating Reseller general information)
account_idformnumberRequiredID of the account to top up the balance
totalformnumberRequiredTotal amount of the payment
commentformstringRequiredComment on the payment
purposeformstringOptionalThe purpose of the top-up payment displayed in the receipt (see Creating a Payment manually)

Response model

If no errors are encountered, the method returns information about the created payment (see Get payment without the included parameter) with the 201 Created status.

Request example

POST /api/v3/resellers/1/payments
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
    "data":
    {
        "attributes":
        {
            "account_id": 505,
            "total": 199.99,
            "comment": "top-up payment",
            "purpose": "prepay payment"
        }
    }
      
}

Response example

{
    "data": {
        "id": "6477",
        "type": "payments",
        "attributes": {
            "created_at": "2019-11-01T06:49:55.347536+0300",
            "updated_at": "2019-11-01T06:49:55.347536+0300",
            "account_id": 505,
            "discount_amount": "0.0",
            "total": "199.99",
			"currency_code": "USD",
            "comment": "top-up payment",
            "status": "waiting_for_payment",
            "document_id": "2005260",
            "expiration_date": null,
            "payment_method_id": null,
            "requester_ip": null,
            "manager_id": null,
            "purpose": "prepay payment",
            "external_total": null,
            "external_currency": null,
            "due_date": null,
            "payment_method_name": null,
            "closed_at": null
        },
        "relationships": {
            "orders": {
                "data": []
            },
            "invoices": {
                "data": []
            },
            "charges": {
                "data": []
            },
            "corrections": {
                "data": []
            },
            "reseller": {
                "data": {
                    "id": "1",
                    "type": "resellers"
                }
            },
            "account": {
                "data": {
                    "id": "505",
                    "type": "accounts"
                }
            },
            "payment_method": {
                "data": null
            }
        }
    }
}