xendit-node icon indicating copy to clipboard operation
xendit-node copied to clipboard

Create Customer validation error 400, message "There was an error with the format submitted to the server."

Open denialfarizi1 opened this issue 3 years ago • 3 comments

ketika menambahkan customer baru selalu terdapat eror 400, misal format yang dikirim { referenceID:'demo_1475801962607', givenNames: 'John', mobileNumber: '+628324234324', email: '[email protected]', } response server selalu muncul "statusCode": 400, "message": "There was an error with the format submitted to the server.", "status": 400, "code": "API_VALIDATION_ERROR" } padahal sudah mengikuti setandar format parameter yang diberikan , saya pikir format ini masih menggunakan standar api xendit versi 1 bukan yang terbaru mohon diupdate dan mohon pencerahannya

denialfarizi1 avatar Nov 30 '21 05:11 denialfarizi1

Selamat siang @denialfarizi1 ,

Setelah saya melakukan pengecekan menggunakan data yang terlampir, saya tidak menemukan error tersebut

Apakah boleh diinformasikan request payload (body dan header) nya untuk kami bantu cek lebih lanjut? Dan apakah ada response array errors yang menunjukkan lokasi kesalahan pada message nya?

luminto17 avatar Nov 30 '21 06:11 luminto17

Saya mengikuti example tautan ini menggunakan akun test https://github.com/xendit/xendit-node/blob/master/examples/with_promises/customer.js

const x = new Xendit({ secretKey: '...', }); dengan request paramter customer referenceID: new Date().toISOString(), givenNames: 'customer 1', email: '[email protected]', mobileNumber: '+6281212345678', description: 'dummy customer', middleName: 'middle', surname: 'surname', addresses: [],

akhirnya mendapatkan error message seperti ini { "error": { "statusCode": 400, "message": "There was an error with the format submitted to the server.", "status": 400, "code": "API_VALIDATION_ERROR" } } adakah solusi lain ?

denialfarizi1 avatar Dec 01 '21 02:12 denialfarizi1

It seems like apiVersion is required field, when I add apiVersion: '2020-05-19', this error disappeared. Thanks.

najibuhuy avatar Sep 06 '22 07:09 najibuhuy

Good Day!

I have the same issue and already added apiVersion: '2020-05-19' but the still got

{ "error_code": "API_VALIDATION_ERROR", "message": "There was an error with the format submitted to the server.", "errors": [ { "message": ""client_reference" is required", "path": [ "body", "client_reference" ], "type": "any.required", "context": { "key": "client_reference", "label": "client_reference" } } ] }

Input: const x = new Xendit({ secretKey: 'apiKey', }) const { Customer } = x const customerSpecification = {} const c = new Customer(customerSpecification) ... c.createCustomer({ referenceID: 'dummy_id', givenNames: 'dummy', email: "[email protected]", mobileNumber:"+639123456789", description: 'dummy customer', middleName: 'middlename', surname: 'surname', addresses: [], apiVersion: '2020-15-19',

tried to pud client_reference but still got same error. I would appreciate the help. Thank you.

arthu9 avatar Nov 24 '22 14:11 arthu9

Your API Version here is apiVersion: '2020-15-19', but it should be apiVersion: '2020-*0*5-19',

Pratyum avatar Jan 31 '23 05:01 Pratyum

Closing this issue as answered, thanks!

adityarx avatar Jun 28 '23 08:06 adityarx