Skip to main content

CoinPayment Create Payment API

POST /coinpaymentCreatePayment

Description

This API endpoint allows users to create a payment through CoinPayment by providing details such as payment category, group ID, additional login count, and the cryptocurrency to be used for the transaction. The endpoint initiates the CoinPayment process and returns various details needed to complete the payment.

Request Body

The request utilizes GraphQL to perform the coinpaymentCreatePayment mutation.

Mutation:

mutation coinpaymentCreatePayment (
$category: PaymentCategory!,
$groupId: Int,
$moreLoginCount: Int,
$coin: String!
) {
coinpaymentCreatePayment (
category: $category,
groupId: $groupId,
moreLoginCount: $moreLoginCount,
coin: $coin
) {
id
error
address
amount
txn_id
confirms_needed
timeout
checkout_url
status_url
qrcode_url
}
}

Variables:

{
"category": "<Payment_Category>",
"groupId": 0,
"moreLoginCount": 0,
"coin": "<Cryptocurrency>"
}
  • category (PaymentCategory Enum): The category of the payment (e.g., subscription, one-time purchase).
  • groupId (Int): The ID of the group associated with the payment.
  • moreLoginCount (Int): The number of additional logins to be included in the payment.
  • coin (String): The cryptocurrency to be used for the payment (e.g., BTC, ETH).

Response:

  • Success (200 OK):

    • If the payment initiation is successful, the response will return the following details:
      • id (String): The ID of the payment transaction.
      • error (String): Any error message encountered during the payment process (if applicable).
      • address (String): The cryptocurrency address to which the payment should be sent.
      • amount (String): The amount of cryptocurrency to be paid.
      • txn_id (String): The transaction ID for the payment.
      • confirms_needed (String): The number of confirmations needed for the transaction.
      • timeout (Int): The timeout for the payment in seconds.
      • checkout_url (String): The URL where the user can complete the payment.
      • status_url (String): The URL where the user can check the status of the payment.
      • qrcode_url (String): The URL for the QR code to be used for payment.
    {
    "data": {
    "coinpaymentCreatePayment": {
    "id": "<Payment_ID>",
    "error": "<Error_Message>",
    "address": "<Crypto_Address>",
    "amount": "<Amount>",
    "txn_id": "<Transaction_ID>",
    "confirms_needed": "<Confirms_Needed>",
    "timeout": "<Timeout>",
    "checkout_url": "<Checkout_URL>",
    "status_url": "<Status_URL>",
    "qrcode_url": "<QRCode_URL>"
    }
    }
    }
  • Error (4XX/5XX):

    • Appropriate error messages and status codes will be returned in cases of invalid data, missing required fields, or payment-related errors.

Note:

Ensure that all required fields are provided and correctly formatted according to the platform's specifications. This API should be used to initiate and manage cryptocurrency payments through CoinPayment, allowing users to complete transactions within the platform.