Pixel (Native Payment Experience)

Sections

Theme switcher

Getting Started - Egypt

Sign up for registering a new account


A guide to registering a new accept account.

Why do I have to? In order to deal with any of Accept's services, you have to register an account, this tutorial will be your guide to create one.

To create your account, follow these steps

  1. Navigate to Accept's home page

2. After that, you will enter your mobile number on which you will be receiving OTP for first-time verification.

3. As soon as you enter the OTP that you have received on your mobile number, you will get the below screen where you will be adding your name, and email details including your desired Password which you will be using for further logging.

4. Please note that after this screen you will get a login screen where you will be entering your registered mobile number without country code and your password which you have set in the previous screen.

5. As soon as you will log in, you will get the below screen to enter your business details.

After filling in this information, you will get a " Registration successful" message on the screen and you will be routed to your Paymob Dashboard as below :

Great-Now you have successfully made your Merchant portal dashboard 

Now you can go to the Sign-In page and start accepting online payments from your customers, Go check our use case guide and choose your perfect payment scenario!

👍Note!

The status of the created account will be marked as a "Test" account, this will allow you to test all of Accept's services. When you finish your testing phase, please contact your Account Manager or Contact Support team through email  support@paymob.com or you can also raise a ticket through a support widget in your Merchant portal Dashboard to change its status to be "Live".

Was this section helpful?

What made this section unhelpful for you?

Accept Dashboard

A detailed guide to your Accept dashboard

In order to deal with any of Accept's services, you have to create an Accept account.

In your Accept portal, you can find:

  • Profile.
  • Payment Integrations.
  • Orders.
  • Transactions.
  • Checkout Customization.

API Checkout Experience

Welcome to the API Checkout Experience documentation! In this guide, you will learn how to integrate and set up our API to provide a seamless and unified checkout experience. This includes everything you need to get started with setting up the API, generating your keys, and configuring both the Unified Intention API Checkout and Pixel Native Payment experiences.

We'll walk you through the basics of the API, including an overview of how it works, step-by-step instructions on how to get your environment set up, and how to use the various endpoints to facilitate secure and efficient transactions.

Was this section helpful?

What made this section unhelpful for you?

Basics of API

Introduction to RESTful APIs and HTTP Methods in Paymob

RESTful Functionality: A RESTful web application exposes its resources along with information about them. It empowers clients to perform actions on these resources, such as creating new ones (e.g., a user profile) or modifying existing ones (e.g., updating a transaction).

For instance, developers can utilize the Paymob Payments API to retrieve specific payment details. Upon making a request, the API responds with essential payment information like amount, currency, and payment method, typically formatted in JSON.

HTTP Methods: HTTP methods, or verbs, denote actions performed on resources. Paymob's APIs support various HTTP methods:

  • GET: Retrieve a representation of a specific resource. Example: Fetching all received payments.
  • POST: Submit data to create a new resource or trigger a state change. Example: Generating a payment link.
  • PUT: Replace all representations of a target resource with the provided payload. Example: Modifying customer details.
  • DELETE: Remove a specified resource. Example: Deleting an invoice.
  • PATCH: Apply partial modifications to a resource. Example: Updating an order with specific changes.

Parameters: Parameters allow customization of API requests and responses. Paymob's APIs support four types of parameters:

  • Path Parameters: Integral parts of the endpoint URL, identifying specific resources.
  • Query Parameters: Appended to the endpoint URL to filter or paginate results.
  • Request Parameters: Included in the request body, transmitting data to the API server.
  • Response Parameters: Represent data returned by the server in response to a request.

HTTPS Status Codes: HTTP status codes communicate the outcome of client requests. Paymob employs HTTPS status codes categorized into three classes:

  • Success (200): Successful response
  • Client Error (400): Error on the transactions.
  • Server Error (500): Internal server error.
Was this section helpful?

What made this section unhelpful for you?

API Setup - (Secret and Public Key)

By comprehending these components, developers can effectively integrate Paymob's APIs into their applications, facilitating seamless payment processing experiences for users while ensuring security and reliability.

This documentation will guide you through the process of integrating with Paymob's powerful APIs and testing them using Postman. Whether you're looking to facilitate online payments, manage transactions, or streamline your e-commerce platform, Paymob APIs offer robust solutions to meet your needs.

Step 1: Sign Up for Paymob

Before diving into the APIs, you'll need to sign up for a Paymob account if you haven't already. Visit this link to know how to create your account. Once registered, you can access your dashboard to manage your integration settings.

Step 2: Get API Key, Secret key, and Public key.

To authenticate and secure your interactions with Paymob's APIs, you'll need to get an API key, secret key, and public key. Follow the steps below to get these keys securely:

Get Test Mode API Key, Secret key, and Public key

  1. Log in to your Paymob account dashboard.
  2. Navigate to the setting section, then into account info.
  3. Click on "View API Key, Secretkey, or public key." However, you need to set your account to 'Test' mode as you'll find this option on the top of your portal page, to update your keys to Test keys.
  4. Your test API key, Secret key, or public key will be displayed. Copy it securely for later use.
  5. Test keys format: egy_pk_test_XXXXXXXXXXXXXX

Get Live Mode API Key, Secret key, and Public key

  1. Log in to your Paymob account dashboard.
  2. Navigate to the Setting Section, then into account info.
  3. Click on "View API Key Secret key or public key."However, you need to set your account to 'Live' mode as you'll find this option on the top of your portal page, to update your keys to live keys
  4. Your live API key, Secret key, or public key will be displayed. Ensure you store it securely.
  5. Live keys format:   egy_pk_live_XXXXXXXXXXXXXXXXX  

Step 3: Testing APIs on Postman

Postman provides a user-friendly interface for testing APIs. Follow these steps to test Paymob's APIs using Postman:

  1. Download and install Postman.
  2. Launch Postman and create a new request.
  3. Enter the API endpoint URL you wish to test.
  4. Set the appropriate HTTP method (GET, POST, PUT, DELETE).
  5. Add any required headers, such as authentication headers with your API key.
  6. Input any necessary request parameters or payloads.
  7. Click "Send" to execute the request and view the response.

Create Intention/ Payment API You can create your payment requests via following simple one-step intension API.

Once you are done with the Intention you need to call this URL. It will open in the browser's window. https://accept.paymob.com/unifiedcheckout/?publicKey=<add your public key here>&clientSecret=<add your client secret key here>

You will get your Public key from your Dashboard as mentioned in the Generating Public key section and you will get your client secret key in the response of Intention API as you see in the below screenshot.

After following this link and opening the consolidating link, you will route to the checkout page as shown below through which you can process your payment.

Header Parameters

Authorizationstring

This is a secret key which you can get from your dashboard in settings.

Content-Typestring

Body Parameters

amountnumber
currencystring
payment_methodsarray

Show child attributes

itemsarray

Show child attributes

billing_dataobject

Show child attributes

customerobject

Show child attributes

extrasobject

Show child attributes

Response

200
Object

Response Attributes

payment_keysarray

Show child attributes

idstring
intention_detailobject

Show child attributes

client_secretstring
payment_methodsarray

Show child attributes

special_referencestring
extrasobject

Show child attributes

confirmedboolean
statusstring
createdstring
card_detailstring
objectstring
Was this section helpful?

What made this section unhelpful for you?

Base URL

End Point:

https://accept.paymob.com/

POST

/v1/intention/

Select
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 curl --location 'https://accept.paymob.com/v1/intention/' \ --header 'Authorization: Token sk_test_626ba4a60a6f9cf4b0bc066ad3de884e93693afd5218ef832e99cbdf76a0fb37' \ --header 'Content-Type: application/json' \ --data-raw '{ "amount": 10, "currency": "EGP", "payment_methods": [ 12, "card", "you can add Integration id directly or your integration name" ], "items": [ { "name": "Item name 1", "amount": 10, "description": "Watch", "quantity": 1 } ], "billing_data": { "apartment": "6", "first_name": "Ammar", "last_name": "Sadek", "street": "938, Al-Jadeed Bldg", "building": "939", "phone_number": "+96824480228", "country": "OMN", "email": "AmmarSadek@gmail.com", "floor": "1", "state": "Alkhuwair" }, "customer": { "first_name": "Ammar", "last_name": "Sadek", "email": "AmmarSadek@gmail.com", "extras": { "re": "22" } }, "extras": { "ee": 22 } }'

Response

{
  "payment_keys": [
    {
      "integration": 114,
      "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "gateway_type": "MIGS",
      "iframe_id": ""
    }
  ],
  "id": "pi_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "intention_detail": {
    "amount": 10,
    "items": [
      {
        "name": "Item name 1",
        "amount": 10,
        "description": "Watch",
        "quantity": 1
      }
    ],
    "currency": "EGP"
  },
  "client_secret": "pak_csk_test_xxxxxxxxxxxxxxxxxxxxxxxxx",
  "payment_methods": [
    {
      "integration_id": 104,
      "alias": "",
      "name": "card",
      "method_type": "online",
      "currency": "EGP",
      "live": false
    },
    {
      "integration_id": 114,
      "alias": "",
      "name": "card",
      "method_type": "online",
      "currency": "EGP",
      "live": false
    }
  ],
  "special_reference": "",
  "extras": {
    "creation_extras": {
      "ee": 22
    },
    "confirmation_extras": ""
  },
  "confirmed": false,
  "status": "intended",
  "created": "2023-09-07T15:48:04.446108+05:00",
  "card_detail": "",
  "object": "paymentintention"
}
Was this section helpful?

What made this section unhelpful for you?

Unified Intention API Experience

The Intention API allows you to create a payment request by providing all the required parameters. Please ensure that all steps and parameters are accurately included to successfully initiate the payment request.


Step 1: You can create your payment request by intention API by adding a "secret key" in the authorization box in the header section. For the secret key please refer to this section.


Step 2: Please send a POST request to the URL below after adding the request parameters in the body mentioned in the below screenshot.

URL: https://accept.paymob.com/v1/intention/

MethodPOST

SourceMerchant's server

RecipientAccept's server

Request:

Response:

Important Notes:

Please make sure to use the configured integration ID while creating the intention.

⇒It's important to maintain separate integration IDs for each environment, whether testing or live. This is because the implemented keys (secret/public keys) differ between environments.

⇒Please be aware that you can customize the intention API setup by including the necessary URLs to override the callback of the notification and redirection URL in your request. This allows you to distinguish between the URLs used for both actions and their callbacks. Use the provided parameters, "notification_url" and "redirection_url," as outlined in the screenshot sample.

⇒Please note that setting the notification URL will only send callback information related to the transaction. If the user clicks the "save card" button, the card token details will not be sent to the notification URL provided in the intention API. Instead, these details will be sent to the updated processed callback configured under the dashboard integration IDs, specifically referencing the Transaction Processed Callback URL set for that integration ID.

⇒Please note that the item array is not mandatory. However, if the merchant provides the item array, then both the items_name and items_amount fields are required.

⇒Please note that the redirection_url functions properly only with the Card payment method. Therefore, you can rely on the URL specified in the integration ID for this method.

  • You will receive a unique webhook URL from the webhook site which you used in the notification url for testing as illustrated in the image below.

To set your webhook URL for the 3DS ID, follow these steps:

  • Navigate to the Developers section and set your webhook URL.
  • Then, go to the Payment Integration section.
  • Click on the integration ID.
  • In the lower section of the page, you can edit the integration details. Add your webhook URL in the "Transaction Processed Callback" section, as shown in the image below.

Step 3: Once you are done with the Intention you need to call below url in the browser's window to access the checkout page as shown below. https://accept.paymob.com/unifiedcheckout/?publicKey=<add your public key here>&clientSecret=<add your client secret key here>

Obtaining Your Keys

To access your Public Key and Client Secret Key, please follow these instructions:

  1. Public Key: You can retrieve your Public Key from your Dashboard. For detailed steps, refer to the section on accessing your Public Key.
  2. Client Secret Key: Your Client Secret Key will be included in the response from the Intention API, as demonstrated in the example below.

Step 4: Please enter your card details. For test credentials, refer to this section.


Step 5: The approval message will be displayed on the screen if the transaction is successful.


Webhook Responses:

Response 1: Callback Response

Response 2: Token

You will receive the token response only if the user selects the "Save Card" option on the checkout page as shown in the below image.


Title
Description
Mandatory

Total Amount

(amount)

Pass the total amount in cents in this parameter.

 

Yes

Payment Methods

(payment_methods)

Provide the configured Integration ID here. Merchants can use the ID as an integer or the name. If the Integration ID is integer, you can pass it without quotes (e.g., 1256). If it includes a name, enclose it in quotes (e.g., "card").

Yes

Currency

(currency)

Specify the currency for the specific region in this parameter. It should be similar to the currency of the integration ID being used. The currency for Egypt is “EGP”.

Yes

Items Description

(description)

It's under the “Items” array and you need to pass a description of the item in this parameter. The description field must not exceed 255 characters.

No.

Items Quantity

(quantity)

It's under the “Items” array and you need to pass the quantity of the item in this parameter.

No

Items Amount

(amount)

Pass the amount of the item in cents in this parameter. In case of passing multiple items, the total amount must be equal to the sum of the amount of the items.

Yes

Items Name

(name)

It's under the “Items” array and you need to pass the name of the item in this parameter. The name field must not exceed 50 characters.

Yes

First Name

(first_name)

Enter your first name in this parameter. It's under the billing data object. The first name field must not exceed 50 characters.

Yes

Last Name

(last_name)

Enter your last name in this parameter. It's under the billing data object. The name field must not exceed 50 characters.

Yes

Email

(email)

Provide your email address in this parameter. It's under the billing data object.

Yes

Country

(country)

Specify your country name in this parameter. It's under the billing data object.

No

Phone Number

(phone_number)

Include your phone number in this parameter. It's under the billing data object. Please note that you can use both international and domestic number formats. For the country code, you can use the alpha-2 or standard format.

Yes

Extras(extras)

You can include any additional parameters in the extras parameter. This can be used by the merchants to send their own parameters and receive it in the callbacks.It will be found in the payment key claims object in the callback.

No

Expiration

(expiration)

The intention duration is in seconds in which the payment intention will remain valid. Once this period elapses, the intention will expire and can no longer be paid.

No

Special Reference(special_reference)

Pass a unique special reference number in this parameter. Refer to a unique or special identifier or reference associated with a transaction or order. It can be used for tracking or categorizing specific types of transactions and it returns within the transaction callback under merchant_order_id.

No

Notification URL(notification_url)

This refers to the URL that will receive the transaction-processed callback POST request after the transaction succeeds or fails, with all transaction details in the body of the request and this only works with card integration ID.

No

Redirection URL(redirection_url)

This refers to the transaction response callback URL that the customer will be redirected to after the transaction succeeds or fails, with most transaction details included as query parameters and this only works with card integration ID.

No


Response

201
Object
Payment Intention created successfully

Response Attributes

payment_keysarray

Show child attributes

intention_order_idnumber
idstring
intention_detailobject

Show child attributes

client_secretstring
payment_methodsarray

Show child attributes

special_referencestring
extrasobject

Show child attributes

confirmedboolean
statusstring
createdstring
card_detailstring
card_tokensarray
objectstring
Was this section helpful?

What made this section unhelpful for you?

POST

/v1/intention/

Select
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 curl --location 'https://accept.paymob.com/v1/intention/' \ --header 'Authorization: Token sk_test_626xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "amount": 2000, "currency": "EGP", "payment_methods": [ 158 ], "items": [ { "name": "Item name", "amount": 2000, "description": "Item description", "quantity": 1 } ], "billing_data": { "apartment": "dumy", "first_name": "ala", "last_name": "zain", "street": "dumy", "building": "dumy", "phone_number": "+92345xxxxxxxx", "city": "dumy", "country": "dumy", "email": "ali@gmail.com", "floor": "dumy", "state": "dumy" }, "extras": { "ee": 22 }, "special_reference": "phe4sjw11q-1xxxxxxxxx", "expiration": 3600, "notification_url": "https://webhook.site/dabe4968-5xxxxxxxxxxxxxxxxxxxxxx", "redirection_url": "https://www.google.com/" }'

Response

{
  "payment_keys": [
    {
      "integration": 158,
      "key": "ZXlKaGJHY2lPaUpJVXpVeE1pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SjFjMlZ5WDJsa0lqbzBNems1TlRZc0ltRnRiM1Z1ZEY5alpXNTBjeUk2TVRBc0ltTjFjbkpsYm1ONUlqb2lSVWRRSWl3aWFXNTBaV2R5WVhScGIyNWZhV1FpT2pRek5EVTVNRGNzSW05eVpHVnlYMmxrSWpveU5qVTNNVFV5TURJc0ltSnBiR3hwYm1kZlpHRjBZU0k2ZXlKbWFYSnpkRjl1WVcxbElqb2lRVzVrY21WaElpd2liR0Z6ZEY5dVlXMWxJam9pVG1samIyeGhjeUlzSW5OMGNtVmxkQ0k2SW1SMWJYa2lMQ0ppZFdsc1pHbHVaeUk2SW1SMWJYa2lMQ0ptYkc5dmNpSTZJbVIxYlhraUxDSmhjR0Z5ZEcxbGJuUWlPaUprZFcxNUlpd2lZMmwwZVNJNkltUjFiWGtpTENKemRHRjBaU0k2SW1SMWJYa2lMQ0pqYjNWdWRISjVJam9pWkhWdGVTSXNJbVZ0WVdsc0lqb2lkR1Z6ZEVCMFpYTjBMbU52YlNJc0luQm9iMjVsWDI1MWJXSmxjaUk2SWlzeU1ERXdNVEF4TURFd01UQWlMQ0p3YjNOMFlXeGZZMjlrWlNJNklrNUJJaXdpWlhoMGNtRmZaR1Z6WTNKcGNIUnBiMjRpT2lKT1FTSjlMQ0pzYjJOclgyOXlaR1Z5WDNkb1pXNWZjR0ZwWkNJNlptRnNjMlVzSW1WNGRISmhJanA3SW1WbElqb3lNbjBzSW01dmRHbG1hV05oZEdsdmJsOTFjbXdpT2lKb2RIUndjem92TDNkbFltaHZiMnN1YzJsMFpTOW1OakExT1RkbU15MDVOMkk1TFRRNU9USXRPVEJsTVMwMlpqazRZVFl6Wm1Nek1tUWlMQ0p5WldScGNtVmpkR2x2Ymw5MWNtd2lPaUpvZEhSd2N6b3ZMM2QzZHk1bmIyOW5iR1V1WTI5dEx5SXNJbk5wYm1kc1pWOXdZWGx0Wlc1MFgyRjBkR1Z0Y0hRaU9tWmhiSE5sTENKdVpYaDBYM0JoZVcxbGJuUmZhVzUwWlc1MGFXOXVJam9pY0dsZmRHVnpkRjlpWkRRNVltSTNabUkwWkdFME9HTm1ZV00wWldNM01XRmlOR1E0WXpRek15SXNJbVY0Y0NJNk1UY3pNVGt6TXpjeU9IMC5wdXluRFcwMjlVazN2TWxEbEE5WGg5azYtZ0RsTEplcHotTnlRYUhiZU9YZXpGWEhGcU9UbmtvbVBzRHZfOFF3SU5RYWd5NkNHdFFVNFY5cU54SXlndw==",
      "gateway_type": "MIGS",
      "iframe_id": null,
      "order_id": 265715202
    }
  ],
  "intention_order_id": 265715202,
  "id": "pi_test_bd49bb7fb4da48cfac4ec71ab4d8c433",
  "intention_detail": {
    "amount": 10,
    "items": [
      {
        "name": "Item name",
        "amount": 5,
        "description": "Item description",
        "quantity": 1,
        "image": null
      },
      {
        "name": "Item name",
        "amount": 5,
        "description": "Item description",
        "quantity": 1,
        "image": null
      }
    ],
    "currency": "EGP",
    "billing_data": {
      "apartment": "dumy",
      "floor": "dumy",
      "first_name": "Andrea",
      "last_name": "Nicolas",
      "street": "dumy",
      "building": "dumy",
      "phone_number": "+201010101010",
      "shipping_method": "",
      "city": "dumy",
      "country": "dumy",
      "state": "dumy",
      "email": "test@test.com",
      "postal_code": ""
    }
  },
  "client_secret": "egy_csk_test_94042f793419c5a0f14a4cadfda9d626",
  "payment_methods": [
    {
      "integration_id": 4345907,
      "alias": null,
      "name": "CardF",
      "method_type": "online",
      "currency": "EGP",
      "live": false,
      "use_cvc_with_moto": false
    }
  ],
  "special_reference": "phe4sjw111q-11221-221",
  "extras": {
    "creation_extras": {
      "ee": 22
    },
    "confirmation_extras": null
  },
  "confirmed": false,
  "status": "intended",
  "created": "2024-11-18T13:42:08.456634",
  "card_detail": null,
  "card_tokens": [],
  "object": "paymentintention"
}
Was this section helpful?

What made this section unhelpful for you?

Pixel (Native Payment Experience)

Introduction

Paymob Pixel's JS SDK empowers merchants to create and customize their checkout experience using pre-built UI components that integrate seamlessly into their website. This allows customers to complete payments directly on the merchant's store without being redirected to Paymob's Hosted Checkout.

Features:

  • Native Payment Experience for Websites and Stores.
  • Fully Customizable UI Components.
  • Enhanced Conversion Rates.
  • Secure Payment Processing.
  • Support for Quick Payment Options such as Apple Pay.

Pre-Requisites

Mandatory:

Optional:

  • Integrate the Update Intention Payment API.

Version

Please get the latest Pixel package from this link.


Supported Payment Methods

Pixel supports only Card Payments and Apple Pay in Egypt.


How does Pixel Work?

  1. Use the Create Intention Payment API to create a payment order.
  2. Pass the client_secret from the Create Intention API response into the clientSecret parameter of the Pixel JS and load the Pixel JS. This will load the Pixel Checkout on the website.
  3. If the order amount or billing details change, call the Update Intention Payment API with the updated order amount, billing data, or both.
  4. Trigger the updateIntentionData event to ensure the updated order details are reflected in the checkout, without needing to reload the Pixel JS.

To Begin Using the Checkout Pixel JS SDK

  1. Include the following script tag in your HTML file:
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/styles.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/main.css">
<script src="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/main.js" type="module"></script> 

Definition of Parameters

  1. publicKey: It can be accessed from the Merchant’s Dashboard → Settings → Account Info. Click on view to access it.

Note: The public key will be different for Test and Live Modes.

JAVASCRIPT
onload = (event) => {
new Pixel({
publicKey: 'egy_pk_test_XXXXXXXXXXXXXXXXXXXX'
});
};

2. clientSecret: Once you fire Intention API, you will receive client_secret in the API Response, which will be used in the Pixel SDK. Client Secret is unique for each order and expires in an hour.

JAVASCRIPT
onload = (event) => {
new Pixel({
clientSecret: 'egy_csk_test_XXXXXXXXXXXXXXXXXXXX'
});
};

3. paymentMethods: Pass card for Card Payments, google-pay for Google Pay, and apple-pay for Apple Pay.

JAVASCRIPT
onload = (event) => {
new Pixel({
paymentMethods: ['card', 'google-pay', 'apple-pay'],
});
};

4. elementId: ID of the HTML element where the checkout pixel will be embedded.

JAVASCRIPT
onload = (event) => {
new Pixel({
elementId: 'paymob-elements',
});
};

5. disablePay: If you don’t want to use Paymob’s Pay Button for Card Payment:

Step 1: pass disablepay as TRUE.

Step 2: Define the button in the script. Once the user clicks on the Button on your website, we will trigger the Pay functionality from our side. The Button ID could be anything but the event should be payFromOutside.

JAVASCRIPT
const event = new Event('payFromOutside');

Step 3: Add the Logic for Event Listener in the script shown below.

If you pass disablePay as false or if the parameter is not passed in the script, the "Pay" Button would be shown for Card Payment. The user will click on Pay Button for Payment Processing.

Note: This functionality can be used only for Card Payment.

JAVASCRIPT
// Step 1:
onload = (event) => {
new Pixel({
disablePay: false/true
});
};
// Step 2:
<button id="payFromOutsideButton">Pay From Outside Button</button>
// Step 3:
const button = document.getElementById('payFromOutsideButton');
button?.addEventListener('click', function () {
// Calling pay request
const event = new Event('payFromOutside');
window.dispatchEvent(event);
});

6. updateIntentionData: When a merchant triggers the Create Intention Payment API with an initial order amount and loads the Pixel SDK on the checkout page, the order amount or billing data may change due to reasons such as shipping charges, discount promo codes, or user updates to billing information. Whenever you update the intention via API, you must also update the intention data within the SDK. Merchants can address this scenario by following these steps:

  1. Call the Update Intention Payment API with the revised order amount, updated billing data, or both.
  2. Trigger the function below as shown below. There's no need to reload the Pixel SDK on Checkout, as the order data will be automatically updated, given the function returns a valid response.
JAVASCRIPT
await Pixel.updateIntentionData();

You can also store the response of the function.

const response = await Pixel.updateIntentionData();

7. showSaveCard: If this parameter is set to true, users will have the option to save their card details for future payment processing. Upon the user's consent to save the card, a token will be included in the Webhook Response sent to the Merchant. When the same token is provided in the Order API, the saved card details will be displayed to the user, allowing them to use the saved card for payment processing.

If this parameter is set to false or if this parameter is not used in the script, users will not be shown the option to save card details with Paymob.

JAVASCRIPT
onload = (event) => {
new Pixel({
showSaveCard: false/true
});
};

8. forceSaveCard: If this parameter is set to true, the user's card details will be saved automatically without requiring their consent.

If this parameter is set to false or if this parameter is not used in the script, the card details will not be saved automatically.

JAVASCRIPT
onload = (event) => {
new Pixel({
forceSaveCard: false/true
});
};

9. beforePaymentComplete: Merchants can implement their own custom logic or functions before the payment is processed by Paymob.

  1. For card payments, whether the user enters their card details and clicks the "Pay" button or the merchant triggers the payment using their own button, the merchant can define a function to instruct Paymob to either proceed with processing the payment or halt it.
  2. For Apple Pay, when the user clicks on the Apple Pay Button, the logic of beforePaymentComplete will be triggered.

The above functionality will be applicable for Card and Apple Pay.

If the Function returns true or it does not return any value, Payment will be processed by Paymob after 5 seconds in this case.

JAVASCRIPT
onload = (event) =>
{
new Pixel({
beforePaymentComplete: async (paymentMethod) =>
{
console.log(paymentMethod);
console.log('Before payment start');
console.log('We are waiting for 5 seconds');
await new Promise(res => setTimeout(() => res(''),5000))
console.log('Before payment end');
return true
},
});
};

If the function returns false, the payment will NOT be processed by Paymob after waiting for 5 seconds.

JAVASCRIPT
onload = (event) =>
{
new Pixel({
beforePaymentComplete: async (paymentMethod) =>
{
console.log(paymentMethod);
console.log('Before payment start');
console.log('We are waiting for 5 seconds');
await new Promise(res => setTimeout(() => res(''),5000))
console.log('Before payment end');
return false
},
});
};

0))

10. afterPaymentComplete: This functionality will only be applicable for Apple Pay. After payment is processed by Paymob, Paymob will send the API response highlighting the status of the transaction, and the merchant can write custom logic to handle the post-payment scenario.

Note: It will work for Card Payments only when the user is not directed to the 3DS OTP Page. If the user is directed to the 3DS OTP Page, then this functionality will not be applicable for Card Payments.

JAVASCRIPT
onload = (event) => {
new Pixel({
afterPaymentComplete: async (response) => {
console.log('After Bannas payment');
console.log(response);
}
});
};

11. onPaymentCancel: This function applies exclusively to Apple Pay. Merchants can implement their own custom logic to handle scenarios where a user cancels the Apple Pay payment by closing the Apple Pay SDK.

JAVASCRIPT
onload = (event) => {
new Pixel({
onPaymentCancel: () => {
console.log('Payment has been canceled');
}
});
};

12. cardValidationChanged: This function will exclusively handle Card Payments. Initially, the value of isValid will be set to false. The function will be triggered whenever there is a change in the card validation state.

When the user enters valid card information that meets the Paymob Card Validation Rules, the isValid value will update to true. However, if the user modifies the card information and it no longer complies with the validation rules, the isValid value will revert to false.

JAVASCRIPT
onload = (event) => {
new Pixel({
cardValidationChanged: (isValid) => {
console.log("Is valid?", isValid);
},
});
};

13. customStyle: To customize the appearance of the checkout pixel, merchants can provide a customStyle object as part of the Checkout Pixel configuration. If the customStyle object is not used, default settings will be applicable.

JAVASCRIPT
onload = (event) => {
new Pixel({
customStyle: {
Font_Family: 'Gotham',
Font_Size_Label: '16',
Font_Size_Input_Fields: '16',
Font_Size_Payment_Button: '14',
Font_Weight_Label: 400,
Font_Weight_Input_Fields: 200,
Font_Weight_Payment_Button: 600,
Color_Container: '#FFF',
Color_Border_Input_Fields: '#D0D5DD',
Color_Border_Payment_Button: '#A1B8FF',
Radius_Border: '8',
Color_Disabled: '#A1B8FF',
Color_Error: '#CC1142',
Color_Primary: '#144DFF',
Color_Input_Fields: '#FFF',
Text_Color_For_Label: '#000',
Text_Color_For_Payment_Button: '#FFF',
Text_Color_For_Input_Fields: '#000',
Color_For_Text_Placeholder: '#667085',
Width_of_Container: '100%',
Vertical_Padding: '40',
Vertical_Spacing_between_components: '18',
Container_Padding: '0'
}
});
};

Sample Screenshot for Pixel


Sample Script

JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pixel</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/styles.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/main.css">
</head>
<style>
.content {
display: flex;
flex-direction: column;
gap: 1rem;
justify-content: center;
align-items: center;
margin-top: 2rem;
}
#paymob-elements {
width: 30%;
}
#payFromOutsideButton {
padding: 0.5rem;
background-color: blue;
color: white;
border-radius: 0.2rem;
}
</style>
</head>
<body>
<position>
<div class="header" style="padding: 1rem; background-color: rgb(233, 255, 207);">
Company Paymob
</div>
<div class="wrapper">
<div class="content">
<div id="paymob-elements"></div>
<button id="payFromOutsideButton">Pay From Outside Button</button>
</div>
</div>
<div class="footer">
</div>
<script src="https://cdn.jsdelivr.net/npm/paymob-pixel@latest/main.js" type="module"></script>
<script src="https://unpkg.com/paymob-pixel/main.js" type="module"></script>
<script>
// Merchant Pay button logic
const button = document.getElementById('payFromOutsideButton');
button?.addEventListener
('click', function ()
{
// Calling pay request
const event = new Event('payFromOutside');
window.dispatchEvent(event);
});
onload = (event) => {
new Pixel({
publicKey: 'egy_pk_live_XXXX',
clientSecret: 'egy_csk_live_XXXX',
paymentMethods: [ 'card','google-pay','apple-pay'],
elementId: 'paymob-elements',
disablePay: false,
showSaveCard :true,
forceSaveCard : true,
beforePaymentComplete: async (paymentMethod) =>
{
console.log(paymentMethod);
console.log('Before payment start');
console.log('We are waiting for 5 seconds');
await new Promise(res => setTimeout(() => res(''),5000))
console.log('Before payment end');
return true
},
afterPaymentComplete: async (response) =>
{
console.log('After Bannas payment');
console.log(response)
},
onPaymentCancel: () =>
{
console.log('Payment has been canceled');
},
cardValidationChanged: (isValid) => {
console.log("Is valid ? ", isValid)
},
customStyle: {
Font_Family: 'Gotham',
Font_Size_Label: '16',
Font_Size_Input_Fields: '16',
Font_Size_Payment_Button: '14',
Font_Weight_Label: 400,
Font_Weight_Input_Fields: 200,
Font_Weight_Payment_Button: 600,
Color_Container: '#FFF',
Color_Border_Input_Fields: '#D0D5DD',
Color_Border_Payment_Button: '#A1B8FF',
Radius_Border: '8',
Color_Disabled: '#A1B8FF',
Color_Error: '#CC1142',
Color_Primary: '#144DFF',
Color_Input_Fields: '#FFF',
Text_Color_For_Label: '#000',
Text_Color_For_Payment_Button: '#FFF',
Text_Color_For_Input_Fields: '#000',
Color_For_Text_Placeholder: '#667085',
Width_of_Container: '100%',
Vertical_Padding: '40',
Vertical_Spacing_between_components: '18',
Container_Padding: '0'
},
});
};
</script>
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
</body>
</html>

Was this section helpful?

What made this section unhelpful for you?

Split Payment Feature

The Split Payment feature typically refers to functionality in payment systems that allows merchants to split the payment cost between the merchant and their sub-accounts.

Implementing a split payment feature involves handling complex transactions and ensuring security and accuracy in the distribution of funds. It requires robust backend systems and interfaces for users to specify how they want to split the payment.


How it Works

  • The customer pays a 100 EGP charge.
  • Paymob collects a 3 EGP fee (3% fees) and adds the remaining 97 EGP to the platform account’s pending balance.
  • The gateway transfers 67 EGP to the restaurant’s main-connected account (including tips and fees) and 30 EGP (converted amount) to the sub-connected account.

How to Enable the Split Payment Feature

Follow these steps to start using the Split Payment feature:

  1. Create an AccountSign up for a Paymob account.
  2. Set Up Payment Methods – Coordinate with your Account Manager to configure the required payment methods under the ‘Integration ID’ tab in your account.
  3. Initiate a Payment Request – Use the Intention API to request payment for the total purchase amount, ensuring that all required fields are included.

Note: If the payment is made on behalf of a sub-entity, you must provide the sub-entity’s ID in the ‘Split MID’ field of the Intention API request. The request format is as follows:

JSON
“split_amounts”: [{"mid": "B" (Child MID), "amount_cents": "X"}]

The Child split percentage should not be more than 97% to avoid having any negative balance. Otherwise, you will get the error below on your request’s response: ["Spliced amount is not greater than 97.0% of the order amount"]


Requesting a Split Payment for a Single Sub-Entity

If your platform processes transactions for a single sub-entity at a time and you charge a commission for facilitating payments, include the following details in the Intention API request:

  • MID of the main entity and the sub-entity.
  • The amount allocated to the sub-entity.
  • Platform commission deducted for the service.

Checking Transaction Breakdown/Transaction Inquiry:

To review transaction details, including applied commissions and fees:

  1. Generate an AUTH token (valid for 60 minutes).
  2. Use the Order ID, Transaction ID, or Merchant Order ID to perform a transaction inquiry.

This will provide a breakdown of the payment, showing how the amounts were split.


Refund/Void Transaction

If you need to refund or (void) a transaction, please refer to this link


Split Transaction on the Dashboard

Please log in to the Paymob dashboard and navigate to the Transactions tab to review split transactions. Select the relevant transaction and check the Converted Amount, VAT, and Fees under the main account.

Additionally, we provide visibility privileges for sub-merchants as follows:

  • The Parent Transaction ID will be displayed under Other References.


Was this section helpful?

What made this section unhelpful for you?

E-Commerce Plugins

Mobile SDKs

Subscriptions

Overview

Paymob provides a comprehensive subscription module designed to help merchants efficiently manage their subscriptions on a variety of billing cycles, including weekly, bi-weekly, monthly, quarterly, semi-annual, and annual plans. This module is tailored to meet the specific needs of each merchant, enabling them to create, manage, and control their subscriptions independently through our APIs.

For any guidance or assistance, please reach out to your account manager. Alternatively, you can contact our support team via email at support@paymob.com. When reaching out, please include details regarding your subscription, such as your Subscription ID and Transaction ID, to help us assist you more efficiently.


Integration Requirements

To successfully set up your subscription plan, you will need two integration IDs:

  • Online 3DS Integration ID: This ID will be used for creating subscriptions.
  • Moto Integration ID: Utilize this ID when creating the subscription plan itself.

Ensure you have both integration IDs ready to streamline the setup process.

If you wish to verify the card user details (provide a free trial for X days period) instead of deducting the amount while creating the subscription then you can ask our support team at support@paymob.com to create a 3DS verification integration ID. Noting this amount will be an auto reversal and you need to set the  "use_transaction_amount": false  to avoid any override with the Subscription plan amount

For further assistance or detailed API guidance, please refer to the subsequent sections of this documentation.

Payment Types

Paymob provides a comprehensive range of payment options to suit various business needs, enhancing the flexibility and security of online transactions. The following are the four primary payment types supported by Paymob:

1. 3D Secure (3DS)

3D Secure (3DS) is a security protocol designed to reduce the risk of fraudulent online transactions by adding an additional layer of authentication. When a cardholder makes a purchase online, 3DS prompts the customer to authenticate their identity with the card issuer during the final stage of the checkout process. This step typically involves entering a one-time password (OTP) or biometric verification, depending on the card issuer’s requirements.

2. Auth and Capture

The Auth and Capture payment method is a two-step process where the transaction is initially authorized, but the funds are not immediately captured. First, the payment gateway authorizes the transaction by confirming that the customer has sufficient funds available, but the actual transaction amount will be captured later. If the transaction is not captured within 07 days, it will be automatically voided.

3. Card Verification

Card Verification Function is a functionality provided by the Network to authenticate a card transaction without actually deducting the transaction amount from the customer’s card.

4. Pay with Saved Card Token

The Pay with Saved Card Token method allows customers to store their card details securely for future transactions. Once a customer has completed a transaction, the payment system stores a unique token that represents their payment method. In subsequent transactions, customers can opt to pay using this saved token without having to re-enter their card details, simplifying the checkout process.


Payment Links

Payment Actions

This section contains the following topics:

  1. Refund Transaction through the Dashboard.
  2. Refund Transaction through API.
  3. Void Transaction through the Dashboard.
  4. Void Transaction through API.
  5. Auth/Capture Transaction through the Dashboard.
  6. Auth/Capture Transaction through API.

Payment Methods

Paymob provides a wide range of payment methods in Egypt, enabling businesses to offer seamless and secure transactions for their customers. Whether through cards, digital wallets, or installment plans, Paymob ensures a smooth payment experience tailored to diverse customer needs. Below is a list of supported payment methods:

  • Card Payments
  • Digital Wallets
  • Apple Pay
  • ValU
  • Bank Installments
  • Souhoola V3
  • Aman V3
  • Forsa
  • Premium
  • Contact
  • HALAN
  • SYMPL
  • Kiosk
  • InstaPay (Coming Soon)

This extensive payment network allows businesses to expand their customer reach and simplify transactions through flexible and accessible solutions.

Test Credentials

Here are the test credentials for the online card payment method:

Mastercard:

Card

Mastercard

Card number

5123456789012346

Cardholder Name

Test Account

Expiry Month

12

Expiry Year

25

CVV

123


Wallet Test Credentials :

Here are the test credentials for Wallets;

Wallet Number

01010101010

MPin Code

123456

OTP

123456

MasterCard For Simulation:

Card

Mastercard

Card number

5123450000000008

Cardholder Name

TEST CARD

Expiry Month

01

Expiry Year

39

CVV

123

VISA Card for Simulation:

Card

VISA

Card number

4111111111111111

Cardholder Name

Test Account

Expiry Month

12

Expiry Year

25

CVV

123

You will simulate both successful and all failed cases outlined below using the VISA card credentials provided above.

Successful Response:

Failed Response:


Was this section helpful?

What made this section unhelpful for you?

Transaction Inquiry API

Retrieve A Transaction allows you to obtain the details and status of a transaction-whether it is successful or failed, using one of the following methods:

  1. Retrieve Transaction with Order ID Use the Order ID to access transaction details.
  2. Retrieve Transaction with Transaction ID Use the Transaction ID to obtain the relevant transaction information.
  3. Retrieve Transaction with Merchant Order ID(Special Reference Number) Access transaction details using the Merchant Order ID (Special Reference Number).

Manage Callback

Welcome to the Manage Callback documentation! In this section, we'll guide you through the different types of transaction callbacks that are essential for handling payment processing and ensuring a seamless integration with your system. Specifically, we'll cover transaction processed callbacks, transaction response callbacks, and how to calculate HMAC for processed callbacks, redirection callbacks, and saved card token objects.

You will learn how to configure and manage these callbacks, understand their role in transaction flow, and ensure that your system securely processes and responds to different events during payment transactions. Whether you're dealing with successful payments, handling failures, or managing tokenized card data, this guide will provide you with the necessary tools and knowledge to handle callbacks efficiently and securely.

Let's dive into understanding each callback type and how to calculate and implement HMAC to ensure the integrity and security of your transactions.

Error Codes

You can find the Risk error codes and other Acquirer response code descriptions in this section to know more about your declines, and detailed reasons.

Bills Portal API

Payouts

Frequently Asked Questions (FAQs)

The Frequently Asked Questions (FAQ) section is a comprehensive resource designed to address common inquiries about our services and features. Here, you will find detailed answers to questions regarding payment methods, transaction processes, technical requirements, and security measures. Whether you're a new user seeking guidance or an experienced merchant looking for specific information, this section aims to provide clarity and support. For any additional questions not covered here, please feel free to reach out to our customer support team at support@paymob.com.