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
});
interface PaymentRequest {
    amountMicros?: number;
    billingAddress?: CdvPurchase.PostalAddress;
    currency?: string;
    description?: string;
    email?: string;
    items: (undefined | PaymentRequestItem)[];
    mobilePhoneNumber?: string;
    platform: Platform;
}

Properties

amountMicros?: number

Amount to pay.

Default to the sum of all items.

billingAddress?: CdvPurchase.PostalAddress

The billing address used for verification. Optional.

currency?: string

Currency.

Some payment platforms only support one currency thus do not require this field.

Default to the currency of the items.

description?: string

Description for the payment.

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.

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.