Skip to content

This project shows sample code for a checkout page that allows customers to pay with credit card or with other payment methods (such as bank transfers).

Notifications You must be signed in to change notification settings

PayU/checkout-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Checkout Page

This project shows sample code for a checkout page that allows customers to pay with credit card or with other payment methods (such as bank transfers). It uses the Secure Fields Form for collecting a customer's card information and invokes the Get Supported Payment Methods API from a node server to fetch all supported additional payment methods. See Building a Checkout Page in the PaymentsOS Developer's Guide for more information.

Important note: The sample code is shown for illustrative purposes only. You will need to modify the code if you want to use it in a production environment. For more information, see the Limitations section below.

Running the Project

To run the project, check it out with:

git clone https://github.com/Zooz/checkout-page.git
cd checkout-page

Install all dependencies:

npm install

Set your authentication keys:

  • Edit server.js and replace app-id and private-key with the id and private key of your Business Unit.

  • Edit src\js\securefields.js. In POS.setPublicKey('xxxxxxxxxxxxxxx'), pass the public key of your Business Unit.

Note: The default provider configured in your Business Unit must support the Get Supported Payment Methods API. Refer to the features overview in the relevant provider guide to determine whether this API is supported by the provider defined in your Business Unit. If the provider does not support the API, you will still to be able to run the project (the list of other payment methods will simply be empty).

Now run the node server:

npm start

You can view the checkout page in http://127.0.0.1:9000/index.html

Limitations

The sample code shown in server.js includes statements that are used for illustrative purposes only and should not be used in a production environment. This includes the following:

  • app.use(cors()). CORS has only been enabled so that you can run the example in your localhost.

  • app-id and private-key are not passed securely. Make sure to implement best practices for passing API keys in your server-side implementation.

About

This project shows sample code for a checkout page that allows customers to pay with credit card or with other payment methods (such as bank transfers).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published