Direct Payment API

What is Direct Payment :

Allows you simply to process the full payment and result within your application or website through our APIs. By passing the needed parameters, we simply take care of executing the transaction and authorize it with the issuer bank through the gateway and return you the result to be displayed within your application. Rest back and relax, all data communicated with MyFatoorah are encrypted!

  • Please note that this feature requires pre-approval for your account with MyFatoorah, please contact the account manager for more details about this

Prerequisite:

To use Direct Payment API, you have to create API user account or use your existing on.

Note: MyFatoorah API user must be activated and Direct Payment enabled for the account

Demo Account
Kindly, use demo information found here.

Steps to use Direct Payment API:

1- Call /Token API to authorize the API user ,this API take username and password and return Token.
This token will be used in all next step to authorize the requests.

2- Call Post ApiInvoices/CreateInvoiceIso API with Token and Invoice model.
Note :
Add this header to the request: "Authorization": "Bearer {token from step 1}

After calling the API you will get an array of all payment methods activated for you.
One of them will be visa /master with direct payment API URL.

"PaymentMethodCode": "vm"

Take the payment URL from this payment method for the next step

"PaymentMethodUrl": "https://apidemo.myfatoorah.com/ApiInvoices/ManageDirectPayment?language=Ar&invoiceKey=050720051152542160&paymentGatewayId=6",

{ 

  "InvoiceValue": 10, 

  "CustomerName": "string", 

  "CustomerAddress": "string", 

  "DisplayCurrencyIsoAlpha": "KWD", 

  "CountryCodeId": 1, 

  "InvoiceItemsCreate": [], 

  "CallBackUrl": "http://www.success.com", 

  "Language": 1, 

  "ExpireDate": "2022-07-29T06:09:03.845Z", 

  "ErrorUrl": "http://www.errorr.com" 

}
{
  "Id": 1525421,
  "IsSuccess": true,
  "Message": "Record Created Successfully!",
  "RedirectUrl": "https://kw.MyFatoorah.com/ia/050720051152542160",
  "FieldsErrors": "",
  "PaymentMethods": [
    {
      "PaymentMethodName": "Visa/master",
      "PaymentMethodUrl": "https://apidemo.MyFatoorah.com/ApiInvoices/ManageDirectPayment?language=Ar&invoiceKey=03051474102741&paymentGatewayId=6",
      "PaymentMethodCode": "vm"
    }
  ],
  "ApiCustomFileds": ""
}

3- Using PaymentMethodUrl that we got it from step2 Create a Post request .
Note :
Add this header to the request: "Authorization": "Bearer {token from step 1}"

Put the card info parameter you collect from the user on the body and call the request

{ 

  "CardExpiryMonth": "05", 

  "CardExpiryYear": "21", 

  "CardSecurityCode": "100", 

  "CardNumber": "2223000000000007" 

}
{ 

  "Status": "success", 

  "Message": "", 

  "IsSuccess": true, 

  "TransactionDetail": { 

    "InvoiceId": "string", 

    "InvoiceReference": "string", 

    "CreatedDate": "string", 

    "ExpireDate": "string", 

    "InvoiceValue": 0, 

    "Comments": "string", 

    "CustomerName": "string", 

    "CustomerMobile": "string", 

    "CustomerEmail": "string", 

    "TransactionDate": "string", 

    "PaymentGateway": "string", 

    "ReferenceId": "string", 

    "TrackId": "string", 

    "TransactionId": "string", 

    "PaymentId": "string", 

    "AuthorizationId": "string", 

    "OrderId": "string", 

    "InvoiceItems": [ 

      { 

        "ProductName": "string", 

        "UnitPrice": "string", 

        "Quantity": "string", 

        "ExtendedAmount": "string" 

      } 

    ], 

    "TransactionStatus": 1, 

    "Error": "string", 

    "PaidCurrency": "string", 

    "PaidCurrencyValue": "string", 

    "TransationValue": "string", 

    "CustomerServiceCharge": "string", 

    "DueValue": "string", 

    "Currency": "string", 

    "ApiCustomFileds": "string", 

    "InvoiceDisplayValue": "string" 

  } 

}
{ "Status": "INVALID", "Message": "Model not valid", "IsSuccess": false, "TransactionDetail": null }