Перейти к основному содержимому

Stripe Create Payment API

POST /stripeCreatePayment

Description

This API endpoint allows users to create a payment through Stripe by providing details such as payment category, group ID, additional login count, renewal option, and Stripe payment method ID. The endpoint initiates the payment process and returns relevant details required to complete the payment.

Request Body

The request utilizes GraphQL to perform the stripeCreatePayment mutation.

Mutation:

mutation stripeCreatePayment (
$category: PaymentCategory!,
$groupId: Int,
$moreLoginCount: Int,
$renew: Boolean,
$stripeMethodId: String
) {
stripeCreatePayment (
category: $category,
groupId: $groupId,
moreLoginCount: $moreLoginCount,
renew: $renew,
stripeMethodId: $stripeMethodId
) {
clientSecret
paymentIntentId
requiresAction
error
}
}

Variables:

{
"category": "<Payment_Category>",
"groupId": 0,
"moreLoginCount": 0,
"renew": true,
"stripeMethodId": "<Stripe_Method_ID>"
}
  • 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.
  • renew (Boolean): A flag indicating whether the payment is for a renewal.
  • stripeMethodId (String): The Stripe payment method ID to be used for the transaction.

Response:

  • Success (200 OK):

    • If the payment initiation is successful, the response will return the following details:
      • clientSecret (String): The client secret needed to complete the payment process with Stripe.
      • paymentIntentId (String): The ID of the payment intent created by Stripe.
      • requiresAction (Boolean): A flag indicating whether further action is required from the user to complete the payment.
      • error (String): Any error message encountered during the payment process (if applicable).
    {
    "data": {
    "stripeCreatePayment": {
    "clientSecret": "<Client_Secret>",
    "paymentIntentId": "<Payment_Intent_ID>",
    "requiresAction": "<Requires_Action>",
    "error": "<Error_Message>"
    }
    }
    }
  • 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 Stripe payments, allowing users to complete transactions within the platform.