Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disbursement error in the format submitted to the server #175

Open
Peepersoak opened this issue Nov 13, 2022 · 1 comment
Open

Disbursement error in the format submitted to the server #175

Peepersoak opened this issue Nov 13, 2022 · 1 comment

Comments

@Peepersoak
Copy link

Getting an error when creating a new Disbursement

import xendit from "xendit-node";
const x = new xendit({
  secretKey: DEVELOPMENT_KEY,
});

const { Disbursement } = x;
const disbursementSpecificOptions = {};
const d = new Disbursement(disbursementSpecificOptions);

const disbursementData = {
  externalID: `disb-${unique_id}`,
  amount: 25,
  bankCode: "PH_GCASH",
  accountHolderName: "John Doe",
  accountNumber: "09971234567",
  description: "Sample disbursement",
};

const resp = await d.create(disbursementData);

The error that I get is this, only this.

{ status: 400, code: 'API_VALIDATION_ERROR', message: 'There was an error with the format submitted to the server.' }

I also tried using the default data but still getting the same error

d.create({
  externalID: 'your-external-tracking-ID',
  bankCode: 'BCA',
  accountHolderName: 'Stan',
  accountNumber: '1234567890',
  description: 'Payment for nasi padang',
  amount: 10000,
})

I'm no longer sure which format is wrong, I double check the data and all of them are in the correct format

@Peepersoak
Copy link
Author

Peepersoak commented Nov 14, 2022

After tying things out with postman, I think one reason might be that I lived and created a disbursement on PH and it has a different format compared to the one being used in Indonesia.

Tried inputting the same data on postman but I got the error that the bank code "PH_GCASH" was not supported since the default secret key in postman which I got from xendit API is located in Indonesia. Change the code to OVO and it works properly. I got the correct response

Now I tried creating my own POST method in postman with my own dev key and it produce a different error, instead of bank_code, it requires a channel_code. Instead of external_id, it requires reference_id, instead of account_holder_name, it only requires account_name and it also required the currency. But in the end, I still get the same error of API_VALIDATION_ERROR with the message of

There was an error with the format submitted to the server.

I think the reason is that PH disbursement has a different format layout compared to the Indonesia one and by default xendit-node only uses the Indonesia format in creating disbursement.

I also can't find the correct format for the PH disbursement in the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant