I am building this payment request object as follows
paymentRequest: google.payments.api.PaymentDataRequest = {
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [
{
type: 'CARD',
parameters: {
allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
allowedCardNetworks: ['AMEX', 'VISA', 'MASTERCARD'],
billingAddressRequired: true,
billingAddressParameters:{
format:'FULL',
phoneNumberRequired:true
}
},
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: 'example',
gatewayMerchantId: 'exampleGatewayMerchantId'
}
}
}
],
merchantInfo: {
merchantId: '12345678901234567890',
merchantName: 'Demo Merchant'
},
transactionInfo: {
totalPriceStatus: 'FINAL',
totalPriceLabel: 'Total',
totalPrice: '0.10',
currencyCode: 'EUR',
countryCode: 'BE'
},
callbackIntents: ['PAYMENT_AUTHORIZATION']
And using this paymentRequest in the html as follows
<google-pay-button
environment="TEST"
buttonType="buy"
buttonColor="black"
[paymentRequest]="paymentRequest"
(loadpaymentdata)="onLoadPaymentData($event)"
(error)="onError($event)"
[paymentAuthorizedCallback]="onPaymentDataAuthorized"></google-pay-button>
My Question:
I want to dynamically add the properties inside request object dynamically. For example I want to add property "billingAddressRequired = true" at some cases alone and for other cases I don't require it. So my request object will not contain "billingAddressRequired" property.