xendit / xendit-php

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services, xenPlatforms
https://developers.xendit.co/api-reference/
MIT License
153 stars 76 forks source link

When I create new customer this error was caused. "There was an error with the format submitted to the server". #175

Closed tabish-ali closed 1 year ago

tabish-ali commented 2 years ago

Request ==>

{
    "customer": {
        "addresses": [
            {
                "city": "Jakarta Selatan",
                "country": "PH",
                "postal_code": "12160",
                "province": "Daerah Khusus Ibukota Jakarta",
                "street_line1": "Jalan Makan",
                "street_line2": "Kecematan Kebayoran Baru"
            }
        ],
        "date_of_birth": "2000-01-01",
        "email": "customer@website.com",
        "given_names": "John",
        "mobile_number": "+6323123123",
        "nationality": "PH",
        "phone_number": "+6323123123",
        "reference_id": "demo_1475801962607",
        "surname": "Doe"
    }
}

Response ==>

{
    "message": "There was an error with the format submitted to the server.",
    "exception": "Xendit\\Exceptions\\ApiException",
    "file": "/home/tabish/programming/laravel/sabong/vendor/xendit/xendit-php/src/HttpClient/GuzzleClient.php",
    "line": 171,
 }
hungphan91 commented 2 years ago

same here

Dagzu commented 1 year ago

same problem here, is there any solution or workaround for this one?

prem-c247 commented 1 year ago

facing same issue when creating customer, is there any solution for it?

tabish-ali commented 1 year ago

Try this format for saving customers.

$customerParamsNew = [ 'reference_id' => referenceID(25), 'type' => $customer->type, 'email' => $customer->email, 'mobile_number' => $customer->tel, 'kyc_documents' => [], 'individual_detail' => [ 'given_names' => $customer->name, ], 'identity_accounts' => [], 'api-version' => '2020-10-31' ];

    you should see what is customer type, i coded this long time, i don't know what it should be and also update the api version to your installed one or try to remove api-version. Generate your own ref id according to your choice. 
adityarx commented 1 year ago

Closing this as resolved