Happy Business Starts Here

Making the payment method created by HPP 2.0 the default payment method

0 Kudos

Making the payment method created by HPP 2.0 the default payment method

We recently shifted from the CORS based implementation of submitting the credit card information to using HPP 2.0 to become PCI compliant.


With the CORS call you can specify if you want to make the payment method default by specifiying `defaultPaymentMethod: true`. So it works seamlessly when the user tries to update the credit card ( in case of a failure ) or create a new subscription some time in the future. 


But with the HPP 2.0 implementation here is how it works. 


- Consume the credit card details and submit the iframe.

- This gives us the paymentMethodId.

-  The above paymentMethodId is then used to tie to a subscription and then the account is updated by making a subscribe() call and setting it as a default payment method.


When the payment fails for some reason, there is a email generated for the user to update the payment method.

At this point, the credit card details are again entered and during submission we pass in `field_accountId` which is the Zuora account number to whom we want to tie the payment. We then have to make a separate API call to set the paymentMethodId as a default explicitly.


I think setting the paymentId as default if the `field_accountId` is passed in avoids the extra step of updating the account, which would save an additional API call.


Here is the link to the support ticket that was created to find the solution for the issue - https://support.zuora.com/hc/en-us/requests/136058?page=1