Get available methods
Using your account Public API Key on MoneyHash class instance you will be able to have the functionality of the following method
Get Account Methods
To access the available pay-in methods, saved cards, and customer balances, call the getMethods with the following search criteria
| Name | Type |
|---|---|
currency | string - required |
amount | string | number - optional |
customer | string - optional |
flowId | string - optional |
operation | enum - optional PURCHASE or AUTHORIZE and the default is PURCHASE |
customFields | Record<string, string | number | boolean> - optionalFilter flow methods based on custom fields on the trigger |
moneyHash
.getMethods({
currency: "<currency>",
amount: "<amount>",
customer: "<customer_id>",
flowId: "<flow_id>",
customFields: "<custom_fields">,
})
.then(({ paymentMethods, expressMethods, savedCards, savedBankAccounts, customerBalances }) => {
console.log({
paymentMethods,
expressMethods,
savedCards,
savedBankAccounts,
customerBalances,
});
});
Get Intent Methods
To access the available pay-in/pay-out methods, saved cards, and customer balances, call the getIntentMethods sending the intent_id as the parameter. For example, you could use this information to predefine a payment method. Or choose which paymentMethods to display to give the customer the option to choose their preferred method.
Creating an Intent
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.
moneyHash
.getMethods({ intentId: "<intent_id>" })
.then(({ paymentMethods, expressMethods, savedCards, customerBalances }) => {
console.log({
paymentMethods,
expressMethods,
savedCards,
savedBankAccounts,
customerBalances,
});
});
Get Intent Details
To access all intent details related to a specific intent_id.
moneyHash
.getIntentDetails("<intent_id>")
.then(({ intent, transaction, selectedMethod, state, stateDetails, shippingData, productItems, nativePayData, recommendedMethods }) => {
console.log({
intent,
transaction,
selectedMethod,
state,
stateDetails,
shippingData,
productItems,
nativePayData,
recommendedMethods
});
});
Proceed With Payment
moneyHash
.proceedWith({
intentId: "<intent_id>",
type: "method" | "savedCard" | "savedBankAccount" | "customerBalance",
id: "<method_id>" | "<card_id>" | "<bank_account_id"> | "<customer_balance_id>",
metaData: {
cvv: "<cvv>", // required for customer saved cards that requires cvv
},
})
.then(({ intent, transaction, selectedMethod, state, stateDetails, shippingData, productItems, nativePayData, recommendedMethods }) => {
console.log({
intent,
transaction,
selectedMethod,
state,
stateDetails,
shippingData,
productItems,
nativePayData,
recommendedMethods,
});
});
Updated 14 days ago