Pay using Card Information
First, create an intent
with the Payment intent
endpoint. This step does not use MoneyHash's Javascript SDK and is standard for all MoneyHash's
integrations, except for HPP. This endpoint requires authentication to be executed
properly. You need to provide the Account API Key as a header and send the required data in the request body.
Check the Create an Intent page for further explanation.
Make sure your card method connection is Server to Server.
Using your account Public API Key on MoneyHash
class instance you will be able to have the functionality of the following method
const moneyHash = new MoneyHash({
type: "payment",
publicApiKey: "<account_public_api_key>",
});
Collect Card Data
After collecting card info as mentioned here.
const cardData = await moneyHash.cardForm.collect();
You will need to render card form fields to be able to collect customer card information.
Pay
const intentDetails = await moneyHash.cardForm.pay({
intentId: "<intent_id>",
cardData, // collected card data from moneyHash.cardForm.collect()
billingData, // optional
shippingData, // optional,
saveCard: "<boolean>", // optional - tokenize card for future use
});
Refer to billing and shipping schema if they are needed to be collected
Note: saveCard
Requires intent to be created with an extra option
"allow_tokenize_card": true
to work.
Updated 2 months ago