Insert an ApplePay payment request in the conversation, returns a promise.
If the payment is successful => execute promise.then(()=>{ })
If there is an error in the payment => execute promise.catch((e : ActionError)=>{ })
type ApplePayPaymentRequestType = {
requestIdentifier: UUID;
payment: ApplePayPaymentRequest;
receivedMessage: ApplePayReceivedMessage;
}
// Detail for payment field type
type ApplePayPaymentRequest {
currencyCode: string;
lineItems: PaymentItem[];
requiredBillingContactFields: ApplePayContactField[];
requiredShippingContactFields: ApplePayContactField[];
shippingMethods: ShippingMethod[];
total: PaymentItem;
}
type PaymentItem = {
amount: string;
label: string;
type: ApplePayLineItemType;
};
enum ApplePayLineItemType {
final,
pending,
}
type ShippingMethod = {
amount: string;
detail: string;
identifier: string;
label: string;
};
enum ApplePayContactField {
email = 'email',
name = 'name',
phone = 'phone',
postalAddress = 'postalAddress',
phoneticName = 'phoneticName',
}
// type for receivedMessage field
type ApplePayReceivedMessage {
type: 'CARD';
data: CardType;
}
type CardType = {
title?: string;
text?: string;
image?: CardImage;
actions: LinkAction[];
};
type CardImage = {
url: string;
description: string;
};
type LinkAction = {
type: 'LINK';
title: string;
url: string;
};
// Error
type ActionError = {
message: string;
details?: string[];
}
client.pushApplePayPaymentRequestInConversationThread(applePayPaymentRequest: ApplePayPaymentRequestType): Promise