1.0.0 • Published 2 years ago

payfort-custom-integration v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Payfort Custom merchant page integration

Payfort standard merchant page integration template offers a customizable but rapid way to start accepting payments on your website. However, you can achieve an even greater degree of customization by building your own payment form to accommodate your unique use-case, business logic, or technical requirements.

How does it work in practice?

If you choose the custom merchant page integration route you are responsible to code a form that captures your customer's payment details and that submits these details to our server using defined parameters. You integrate your custom form on your checkout page.

There is no need to change the look and feel of your merchant site. You can customize the iframe to match your site. Simply insert the Amazon Payment Services iframe in the section of your page where you want to accept credit card payments.

In practice, custom merchant page integration works like this:

  • You develop a custom payment form that collects the credit card details including card number, expiry date, CVV number.
  • Your customer fills in their card details in the custom payment form on your checkout page.
  • The Amazon Payment Services server receives the card details and attempts to authorize the customer's payment.
  • Amazon Payment Services sends a confirmation to your checkout page to complete the transaction, this confirmation includes a token.
  • You use the token to complete the Authorization or Purchase operation.

Install

npm install payfort-custom-integration --save

And here's some code! :+1:

// Initialize the payfort package
const payfort = require("payfort-custom-integration");
// Create client for payment
const client = payfort.createClient("development", {
  access_code : "your_access_code",
  merchant_identifier : "your_merchant_identifier",
  passphrase : "your_passphrase"
  purchase_url : "send this only to override default urls"
});
// Purchase data object sample
const purchaseData = {
  "amount": data.amount,
  "command" : "PURCHASE", // PURCHASE OR AUTHORIZATION
  "currency": data.currency,
  "customer_email": data.email,
  "customer_name": data.name,
  "language": "en",
  "return_url": "https://your_website.com/callback-page",
  "merchant_reference": data.order_id
};
//Send payment request
payfort.sendRequest(client, purchaseData)

Bugs or improvements

Every project needs improvements, Feel free to report any bugs or improvements. Pull requests are always welcome.

Advertise for Job/Work Contract

I am open for a good job or work contract. You can contact me directly on my email (bera.ujjwal@hotmail.com) or on my skype ujjwalbera.

Buy me a Coffee

Hi! I'm Ujjwal Bera, I'm an open source enthusiast and devote my free time to building projects in this field.

I'm the creator and maintainer of payfort, MNode and SNode.

I'm doing my best to provide you a good experience when using my apps, so if you like what I'm doing and wish to say "thanks!", You can appreciate me or my hard work and time spent to create this helpful structure with buying me a coffee.