Skip to content

400 Response from promise on app.charge(...) and app.payout(...) #23

@codehakase

Description

@codehakase

Hello Team!

The SDK throws a Request failed with status code 400 (from all possible ways of catching the error, that message is still returnedThis error is thrown sometimes on theapp.charge(...)andapp.payout(...)` methods.

Here's a snippet of how I'm calling each methods:

const handler = async () => {
 try { // parent
  ...
  let dapp;
  try {
   dapp = await MobiusClient.AppBuilder.build(keypair, userPublicKey);
  } catch (err) {
   if (err) {
    throw new Error(err.message);
   }
  }
  // process payout
  try {
   await dapp.payout(amount); // or await dapp.charge(amount)...
   console.log(`New payout of ${amount} made to ${userPublicKey}`);
  } catch (err) {
   if (err) throw new Error(`could not make payout to user: ${err.message}`);
  }
 }
 catch (err) {
  if (err) {
   // custom error handling here
  }
 }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions