پرش به مطلب اصلی

PayPal Create Payment API

POST /paypalCreatePayment

Description

This API endpoint allows users to create a payment through PayPal by providing details such as payment category, group ID, and additional login count. The endpoint initiates the PayPal payment process and returns the necessary order ID.

Request Body

The request utilizes GraphQL to perform the paypalCreatePayment mutation.

Mutation:

mutation paypalCreatePayment (
$category: PaymentCategory!,
$groupId: Int,
$moreLoginCount: Int
) {
paypalCreatePayment (
category: $category,
groupId: $groupId,
moreLoginCount: $moreLoginCount
) {
orderId
}
}

Variables:

{
"category": "<Payment_Category>",
"groupId": 0,
"moreLoginCount": 0
}
  • 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.

Response:

  • Success (200 OK):

    • If the payment initiation is successful, the response will return the following detail:
      • orderId (String): The order ID created by PayPal, which is necessary to complete the payment process.
    {
    "data": {
    "paypalCreatePayment": {
    "orderId": "<Order_ID>"
    }
    }
    }
  • 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 PayPal payments, allowing users to complete transactions within the platform.