Can I test recurring payments with a testaccount or something? When I try to create a recurring payment I get the following 422 error: "Error executing API call (422: Unprocessable Entity): Unable to process application request for this account".
Is that because I don't have this account verified/setup? Is there a way to avoid all this. I have testmode enabled in the request.
#Testing recurring payments
1 messages · Page 1 of 1 (latest)
You can test the creation of customers, first payments and recurring payments all in testmode! Could you share the endpoint and payload of the request (without PII / credentials) so we can have a look?
I'm using the mollie/laravel-mollie package
This is the call I'm making:
$firstPayment = Mollie::api()->payments()->create([
'amount' => [
'currency' => $clubPsp->club->settings->currency,
'value' => formatPriceDecimal($subscription->price),
],
'description' => $subscription->name,
'redirectUrl' => route('subscription.webhook'),
'webhookUrl' => route('subscription.webhook'),
'method' => 'ideal',
'sequenceType' => 'first',
'customerId' => $mollieCustomer->id,
'profileId' => $profileId,
'testmode' => config('app.env') !== 'production',
'applicationFee' => [
'amount' => [
'currency' => 'EUR',
'value' => '0.50'
],
'description' => sprintf('Transaction fee of subscription %d', $subscription->id)
]
]);
So that's the payments endpoint
Creating a customer is working. But then the first payment is not working.
The error usually is the result from a payload not being in line with what we expect (syntactically, for instance). Could you maybe assign the object that serves as a argument for the create method into a variable and var_dump it so we can inspect its structure?
array(10) {
["amount"]=>
array(2) {
["currency"]=>
string(3) "EUR"
["value"]=>
string(5) "45.00"
}
["description"]=>
string(14) "Jaarabonnement"
["redirectUrl"]=>
string(65) "https://7f60-85-146-143-59.ngrok-free.app/v1/subscription/webhook"
["webhookUrl"]=>
string(65) "https://7f60-85-146-143-59.ngrok-free.app/v1/subscription/webhook"
["method"]=>
string(5) "ideal"
["sequenceType"]=>
string(5) "first"
["customerId"]=>
string(14) "cst_v4sJ2P3t7c"
["profileId"]=>
string(14) "pfl_rjshQZNrEB"
["testmode"]=>
bool(true)
["applicationFee"]=>
array(2) {
["amount"]=>
array(2) {
["currency"]=>
string(3) "EUR"
["value"]=>
string(4) "0.50"
}
["description"]=>
string(33) "Transaction fee of subscription 1"
}
}
At a first glance: Your webhook url is the same as the redirecturl. Don’t know if that triggers the 422.
Normally in the 422 response there is also a field parameter to tell you which field is triggering the 422: https://docs.mollie.com/overview/handling-errors#id6
What type of credentials do you use to authorize this call? This will only work with an access-token obtained via OAuth
webhookUrl can be equal to redirectUrl, btw. Richard's remark to check the error-message that usually comes with the 422 is a good suggestion!
Could you try without the application fee you added in the request? I think this is where the issue is.
Also, are you using the same organization that has the OAuth App to create this payment with an application fee? You should be using two accounts: 1 that has the OAuth App (your account as a partner), and a different account that will mimick your customer.
I'm using an oAuth token from another test account.
Will also check this
Okay, will try this too.
No they are 2 different accounts.
Okay @placid storm @tepid sail without the applicationFee it worked. So I double checked if the app account was different from the customer and it was the same 🤦♂️
So now I authenticated with my other account, but I get a new error message. "Error executing API call (422: Unprocessable Entity): The payment method does not support sequence type"
Could it be that baecause iDeal is not activated on this test account is the problem?