Skip to content

Latest commit

 

History

History
129 lines (84 loc) · 2.66 KB

CdvPurchase.PaymentRequest.md

File metadata and controls

129 lines (84 loc) · 2.66 KB

Interface: PaymentRequest

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
 });

Table of contents

Properties

Properties

amountMicros

Optional amountMicros: number

Amount to pay.

Default to the sum of all items.


billingAddress

Optional billingAddress: PostalAddress

The billing address used for verification. Optional.


currency

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

Optional description: string

Description for the payment.


email

Optional email: string

The email used for verification. Optional.


items

items: (undefined | PaymentRequestItem)[]

Products being purchased.

They do not have to be products registered with the plugin, but they can be.


mobilePhoneNumber

Optional mobilePhoneNumber: string

The mobile phone number used for verification. Optional.

Only numbers. Remove dashes, parentheses and other characters.


platform

platform: Platform

Platform that will handle the payment request.