Accept PayPal payments in your online store.
PayPal allows your customers to make payments in your app or website using funds added to their PayPal account. Use the emerchantpay PayPal API to accept PayPal as a payment method across all of emerchantpay’s payment integrations.
|Payment method||Countries/regions||Supported payments|
|eWallet||Global||PayPal Wallet (funded via card, bank account, )|
To proceed with this solution, you must have an emerchantpay merchant account. Apply for a merchant account by filling out and submitting this contact form.You will be assigned an emerchantpay Account Manager, who will provide you with credentials and assist you with any of emerchantpay’s payment solutions.
To integrate with PayPal, connect to the emerchantpay Genesis gateway using the emerchantpay PayPal API. You should have a working knowledge of web programming languages, HTTP methods in XML and JSON formats, and UTF8 encoding. Use the Genesis SDK libraries with code samples to integrate with the gateway in a range of languages.For a solution that requires less development overhead, accept PayPal payments through the emerchantpay Web Payment Form (WPF). Contact your Account Manager and tell them you want to accept PayPal through the WPF, and refer to the WPF API.
1. Create a PayPal payment request
To submit a payment using PayPal, create a PayPal payment request to the emerchantpay Genesis payment gateway. Specify pay_pal as the
transaction_type and the type of payment in
<?xml version=”1.0″ encoding=”UTF-8″?> <payment_transaction> <transaction_type>pay_pal</transaction_type> <transaction_id>119643250547501c79d8295</transaction_id> <payment_type>authorize</payment_type> <usage>40208 concert tickets</usage> <remote_ip>13.456.789.0</remote_ip> <amount>100</amount> <currency>USD</currency>
2. Receive a response
You will receive a Success or Error response to your payment request.Example of a Success response:
<?xml version=”1.0″ encoding=”UTF-8″?> <payment_response> <transaction_type>pay_pal</transaction_type> <status>approved</status> <mode>live</mode> <transaction_id>119643250547501c79d8295</transaction_id> <unique_id>44177a21403427eb96664a6d7e5d5d48</unique_id> <consumer_id>123456</consumer_id> <avs_response_code>5I</avs_response_code> <avs_response_text>Response provided by issuer processor; Address information not verified</avs_response_text> <authorization_code>345678</authorization_code> <response_code>00</response_code> <timestamp>2022-06-29T15:36:35Z</timestamp> <descriptor>Descriptor one</descriptor> <amount>100</amount> <currency>USD</currency> <sent_to_acquirer>true</sent_to_acquirer> <scheme_transaction_identifier>019091214161031</scheme_transaction_identifier> </payment_response>
redirect_urlto redirect your customer to authorise the payment with PayPal. See the emerchantpay PayPal API for the complete list of PayPal response parameters and code samples.
Because the PayPal payment transaction is asynchronous, the result of your customer’s payment is sent as a separate HTTP POST notification from the gateway to the
notification_url that you supplied with the transaction request.
:transaction_id=>”1e50a741730df25a0bf202″ :terminal_token=>”3d566f6cab557e15325c40540″ :unique_id=>”b2e2feb2f26243dca283b” :transaction_type=>”pay_pal” :status=>”approved” :signature=>”301b0a3de57d1e93653b073dd8d1d63b” :amount=>20000 :customer_email=>”firstname.lastname@example.org” :customer_phone=>”+44123456789″ :first_name=>”John” :last_name=>”Smith” :state=>”ress”
statusfield provides you with information on the outcome of the transaction. See Transaction States for more information about transaction statuses.
signature field to verify that the notification has been sent by the Genesis gateway. Each session signature is generated by combining the
unique_id of the transaction and your API password, and generating a SHA-1 hash function of the combined string.
Notification signature examples:
signature = SHA-1 hash value of
After you have verified the notification state and validity, render an XML page containing the transaction’s unique id to acknowledge that you have received the notification.Example of a notification reply you use to confirm a notification:
<?xml version=”1.0″ encoding=”UTF-8″?> <notification_echo> <unique_id>3f760162ef57a829011e5e2379b3fa17</unique_id> </notification_echo>
3. Test your integration
Before you can accept live payments, you must test your integration in the emerchantpay staging environment.
- Add an item to your cart in your online store.
- Proceed to the checkout page and check out using the PayPal button.
- Follow the redirect link to PayPal’s website
- Log in to PayPal.
- Set the payment status to Confirm.
- Log in to Genesis.
- In the navigation menu, go to Payment transactions.
- Verify that the transaction appears at the top of the list and is successful.
4. Accept live payments
After you have successfully tested your PayPal integration, you are ready to move to the production environment and accept live payments. Contact your emerchantpay Account Manager to get your login credentials for the Genesis production environment.
You are now ready to accept live payments using PayPal.