Happy Business Starts Here

Highlighted
Zuora Alumni

[SOAP] Option to not save credit card on file

Problem Statement: 

When a customer purchases an item a la carte (a non-renewing product) we ask them if they want to save their card or not. If they choose to not save the card, we do not store the information.

 The card they are using to purchase is automatically being set as the account default card. Is there a way to null out this field so that I can delete the payment method without adding another payment method to take its place?

 

Solution: The logic is to create an External Payment (cash, check, etc) as default payment method, then delete the credit card.

1, Query the cash default payment method ID, note that for External Payments, the ID is on tenant level and not account level.

<NS1:QUERY>
      <NS1:QUERYSTRING>SELECT ID, ACCOUNTID FROM PAYMENTMETHOD WHERE TYPE = 'CASH'</NS1:QUERYSTRING>
</NS1:QUERY>

2, With the cash default payment ID returned, change the customer's account (Account object) default payment to cash. Please note that "AutoPay" must set to "false" for External Payments

<NS1:UPDATE>
      <NS1:ZOBJECTS XSI:TYPE="NS2:ACCOUNT">
            <NS2:ID>2C92C0F9518A922501518F6CDEF770C0</NS2:ID>
            <NS2:DEFAULTPAYMENTMETHODID>2C92C0F84D4D6ED4014D4EAB66EA33E9</NS2:DEFAULTPAYMENTMETHODID>
            <NS2:AUTOPAY>FALSE</NS2:AUTOPAY>
      </NS1:ZOBJECTS>
</NS1:UPDATE>

3, Find the payment method ID for the credit card

<NS1:QUERY>
      <NS1:QUERYSTRING>SELECT ID, ACCOUNTID FROM PAYMENTMETHOD WHERE ACCOUNTID = '2C92C0F9518A922501518F6CDEF770C0' AND TYPE = 'CREDITCARD'</NS1:QUERYSTRING>
</NS1:QUERY>

4, Delete the credit card (PaymentMethod object)

<NS1:DELETE>
      <NS1:TYPE>PAYMENTMETHOD</NS1:TYPE>
      <NS1:IDS>2C92C0F9518A922501518F6CDEFD70C2</NS1:IDS>
</NS1:DELETE>

 

Supporting Documentation:

Payment Method Object: https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/E1_SOAP_API_Object_Reference/PaymentMethod

Account Object: https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/E1_SOAP_API_Object_Reference/Account

query(): https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/E_SOAP_API_Calls/query_call

delete(): https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/E_SOAP_API_Calls/delete_call

update(): https://knowledgecenter.zuora.com/BC_Developers/SOAP_API/E_SOAP_API_Calls/update_call



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √