انتقل إلى المحتوى الرئيسي

Switch Start Endpoint

GET /api/e-payment/switch/start

Parameters:

orderId: the order id
gatewayId: payment gateway id
businessId: business id, this will be taken from the header, but can be sent.
frontendRedirectUrl: the frontend redirect url, this will make sure that after the client has paid it will return him to this url

Responses:

1- Success

Status Code: 200 - OK

info: returns the payment form details. see

body:

{
"formAction": "string",
"formClass": "string",
"formDataBrands": "string",
"scriptSrc": "string",
"scriptIntegrity": "string",
"scriptCrossOrigin": "string",
"transactionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

2- Invalid Business Id

Status Code: 400 - Bad Request

info: if the business id is not a valid Guid

body:

Invalid business id

3- frontendRedirectUrl is not valid

Status Code: 400 - Bad Request

info: if the frontendRedirectUrl is empty. Note: the frontendRedirectUrl should be url encoded

body:

frontendRedirectUrl is not valid

4- Business has no e-payment service subscription

Status Code: 400 - Bad Request

info: if the user does not have a subscription of e-payment

body:

Business has no e-payment service subscription

5- order not found

Status Code: 404 - Not Found

info: if the order with the id sent is not found, or the order belongs to a different business

body:

order not found

6- order total price should not be zero

Status Code: 400 - Bad Request

info: if the price of the order is zero

body:

order total price should not be zero

7- order is not a cart

Status Code: 400 - Bad Request

info: the order status should be a cart

body:

order is not a cart

8- payment type is not online

Status Code: 404 - Not Found

info: order payment type should be online

body:

payment type is not online

9- payment already done

Status Code: 400 - Bad Request

info: this means that a transaction associated with this order already with Success status

body:

payment already done

10- payment gateway not found

Status Code: 404 - Not Found

info: the payment gateway is not found or belongs to a different business, or inactive, or deleted.

body:

payment gateway not found

11- invalid payment gateway type

Status Code: 400 - Bad Request

info: the payment gateway is not of type switch

body:

invalid payment gateway type

12- Failed to get payment id

Status Code: 500 - Internal Server Erorr

info: something went wrong while sending the prepare request to switch api

body:

Failed to get payment id