I want to update customer object with new address id. How can anyone push address id in the array of addresses object of the customer?
Thanks @Vikash_Kumar,
The address can be updated through the Address Object and Update Address.
The address should have an address ID in this case "id": "address_c67d5ef3aa054cc8a8ffc16944d33ccc",
Retrieve Customer
Use the ID cus_e351b78941cc294ff44b4e4182969470
to retrieve the customer object.
Response
{
"status": {
"error_code": "",
"status": "SUCCESS",
"message": "",
"response_code": "",
"operation_id": "e6f1f4ab-2a7f-4453-a734-08ed625505ac"
},
"data": {
"id": "cus_e351b78941cc294ff44b4e4182969470",
"delinquent": false,
"discount": null,
"name": "Singapore Customer",
"default_payment_method": "card_8f93670eb8ec447721d90ca403d63d9a",
"description": "",
"email": "test@gmail.com",
"phone_number": "+655555555555",
"invoice_prefix": "",
"addresses": [
{
"id": "address_c67d5ef3aa054cc8a8ffc16944d33ccc",
"name": "Singapore Customer",
"line_1": "123 Main St",
"line_2": "",
"line_3": "",
"city": "Singapore",
"state": "01",
"country": "SG",
"zip": "4444",
"phone_number": "",
"metadata": {},
"canton": "",
"district": "",
"created_at": 1638568973
}
],
"payment_methods": {
"data": [
{
"id": "card_8f93670eb8ec447721d90ca403d63d9a",
"type": "sg_credit_cup_card",
"category": "card",
"metadata": {},
"image": "https://iconslib.rapyd.net/checkout/sg_credit_cup_card.png",
"webhook_url": "",
"supporting_documentation": "",
"next_action": "not_applicable",
"name": "Singapore Customer",
"last4": "1111",
"acs_check": "unchecked",
"cvv_check": "unchecked",
"bin_details": {
"type": null,
"brand": null,
"country": null,
"bin_number": "411111"
},
"expiration_year": "28",
"expiration_month": "12",
"fingerprint_token": "ocfp_2a694038316f52122bbbb3ae926cfda9"
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/customers/cus_e351b78941cc294ff44b4e4182969470/payment_methods"
},
"subscriptions": null,
"created_at": 1638568973,
"metadata": {},
"business_vat_id": "",
"ewallet": ""
}
}
Update Address
Use ID address_c67d5ef3aa054cc8a8ffc16944d33ccc
to update the address.
Request
{
"metadata": {
"merchant_defined": "updated"
},
"line_1": "21 Jalan Melati",
"city": "Singapore",
"zip": "368907"
}
Response
{
"status": {
"error_code": "",
"status": "SUCCESS",
"message": "",
"response_code": "",
"operation_id": "8a97cdbe-2c5e-408f-a5ae-6d778814491d"
},
"data": {
"id": "address_c67d5ef3aa054cc8a8ffc16944d33ccc",
"name": "Singapore Customer",
"line_1": "21 Jalan Melati",
"line_2": "",
"line_3": "",
"city": "Singapore",
"state": "01",
"country": "SG",
"zip": "368907",
"phone_number": "",
"metadata": {
"merchant_defined": "updated"
},
"canton": "",
"district": "",
"created_at": 1638568973
}
}
Retrieve Customer
Response
{
"status": {
"error_code": "",
"status": "SUCCESS",
"message": "",
"response_code": "",
"operation_id": "82ac0da0-2e0b-4c7f-84f2-c8ebadff5794"
},
"data": {
"id": "cus_e351b78941cc294ff44b4e4182969470",
"delinquent": false,
"discount": null,
"name": "Singapore Customer",
"default_payment_method": "card_8f93670eb8ec447721d90ca403d63d9a",
"description": "",
"email": "test@gmail.com",
"phone_number": "+655555555555",
"invoice_prefix": "",
"addresses": [
{
"id": "address_c67d5ef3aa054cc8a8ffc16944d33ccc",
"name": "Singapore Customer",
"line_1": "21 Jalan Melati",
"line_2": "",
"line_3": "",
"city": "Singapore",
"state": "01",
"country": "SG",
"zip": "368907",
"phone_number": "",
"metadata": {
"merchant_defined": "updated"
},
"canton": "",
"district": "",
"created_at": 1638568973
}
],
"payment_methods": {
"data": [
{
"id": "card_8f93670eb8ec447721d90ca403d63d9a",
"type": "sg_credit_cup_card",
"category": "card",
"metadata": {},
"image": "https://iconslib.rapyd.net/checkout/sg_credit_cup_card.png",
"webhook_url": "",
"supporting_documentation": "",
"next_action": "not_applicable",
"name": "Singapore Customer",
"last4": "1111",
"acs_check": "unchecked",
"cvv_check": "unchecked",
"bin_details": {
"type": null,
"brand": null,
"country": null,
"bin_number": "411111"
},
"expiration_year": "28",
"expiration_month": "12",
"fingerprint_token": "ocfp_2a694038316f52122bbbb3ae926cfda9"
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/customers/cus_e351b78941cc294ff44b4e4182969470/payment_methods"
},
"subscriptions": null,
"created_at": 1638568973,
"metadata": {},
"business_vat_id": "",
"ewallet": ""
}
}