CdvPurchase.PaymentRequest
Request for payment.
Use with Store.requestPayment to initiate a payment for a given amount.
Example
const {store, Platform, ErrorCode} = CdvPurchase;
store.requestPayment({
platform: Platform.BRAINTREE,
items: [{
id: 'margherita_large',
title: 'Pizza Margherita Large',
pricing: {
priceMicros: 9990000,
}
}, {
id: 'delivery_standard',
title: 'Delivery',
pricing: {
priceMicros: 2000000,
}
}]
amountMicros: 11990000,
currency: 'USD',
description: 'This this the description of the payment request',
})
.cancelled(() => { // user cancelled by closing the window
})
.failed(error => { // payment request failed
})
.initiated(transaction => { // transaction initiated
})
.approved(transaction => { // transaction approved
})
.finished(transaction => { // transaction finished
});
• Optional
amountMicros: number
Amount to pay.
Default to the sum of all items.
• Optional
billingAddress: PostalAddress
The billing address used for verification. Optional.
• Optional
currency: string
Currency.
Some payment platforms only support one currency thus do not require this field.
Default to the currency of the items.
• Optional
description: string
Description for the payment.
• Optional
email: string
The email used for verification. Optional.
• items: (undefined
| PaymentRequestItem
)[]
Products being purchased.
They do not have to be products registered with the plugin, but they can be.
• Optional
mobilePhoneNumber: string
The mobile phone number used for verification. Optional.
Only numbers. Remove dashes, parentheses and other characters.
• platform: Platform
Platform that will handle the payment request.