In-page checkout

Inpage checkout

1. Set up MoneyCollect

Use our official libraries for access to the MoneyCollect API from your application:

2. Create a Payment

MoneyCollect uses a Payment object to represent your intent to collect payment from a customer, tracking charge attempts and payment state changes throughout the process.

Handle any next actions

Add an endpoint on your server that creates a Payment. A Payment tracks the customer’s payment life cycle, keeping track of any failed payment attempts and ensuring the customer is only charged once. Return the Payment’s client secret in the response to finish the payment on the client.

3. Build a checkout page on the client

Load MoneyCollect.js Use McPayment.js to remain PCI compliant by ensuring that payment details are sent directly to MoneyCollect without hitting your server. Always load MoneyCollect.js from static.moneycollect.com to remain compliant. Don’t include the script in a bundle or host it yourself.

Define the payment form

Add an empty placeholder div to your checkout form. MoneyCollect inserts an iframe into this div that securely collects payment information.

Initialize MoneyCollect.js

Initialize MoneyCollect.js with your publishable API keys. You will use MoneyCollect.js to create the Payment Element and complete the payment on the client.

Fetch a Payment

Immediately make a request to the endpoint on your server to create a new Payment as soon as your checkout page loads. The clientSecret,id returned by your endpoint is used to complete the payment.

Initialize MoneyCollect Elements

Initialize the MoneyCollect Elements UI library with the client secret. Elements manages the UI components you need to collect payment details.

Customlize your payment page language

You can customize the page language through setting the parameterlang .

Currently supports:

e.g.

If the current browser language is one of the supported languages, the language will be displayed; otherwise, English will be displayed by default

4. Complete the payment on the client

Handle the submit event

Listen to the form’s submit event to know when to confirm the payment through the MoneyCollect API.

Complete the payment

Call confirmPayment(), passing along the PaymentElement and a return_url to indicate where MoneyCollect should redirect the user after they complete the payment. For payments that require authentication, MoneyCollect displays a modal for 3D Secure authentication or redirects the customer to an authentication page depending on the payment method. After the customer completes the authentication process, they’re redirected to the return_url.

5. Handle post-payment events

Use a webhook

When the notifyUrl parameter is passed, MoneyCollect will use the URL to asynchronously notify the transaction result.

And for detailed guidance on managing webhooks, processing refunds, and handling responses after the payment, please refer to the following documentation.

After the payment

6. Additional testing resources

There are several test cards you can use to make sure your integration is ready for production. Use them with any CVC, postal code, and future expiration date.

NUMBER
Brand
DESCRIPTION

4242 4242 4242 4242

Visa

Succeeds and immediately processes the payment.

3566 0020 2036 0505

JCB

Succeeds and immediately processes the payment.

6011 1111 1111 1117

Discover

Succeeds and immediately processes the payment.

3782 8224 6310 0052

American Express

Succeeds and immediately processes the payment.

5555 5555 5555 4444

Mastercard

Succeeds and immediately processes the payment.

4000 0000 0000 0077

Visa

Always fails with a decline code of declined.

4000002500003155

Visa

This card requires 3D authentication on all transactions

Last updated