Replies: 1 comment
-
I think your problem is that you have to return the property "id" in the function "initiatePayment": async initiatePayment(
context: CreatePaymentProviderSession
): Promise<PaymentProviderError | PaymentProviderSessionResponse> {
try {
const { currency_code, amount } = context;
const formattedAmount = (amount as number).toFixed(2);
const payment = await this.mollieClient.payments.create({
method: PaymentMethod.creditcard, /// test payment method to creditCard (for testing)
amount: {
currency: currency_code.toUpperCase(),
value: formattedAmount,
},
description: "Payment for order",
redirectUrl: `${process.env.MOLLIE_REDIRECT_URL}`,
webhookUrl: `${this.options_.webhookUrl}/hooks/payment/mollie_mollie`,
// Only add customer details if they exist
...(context.context?.email && {
billingEmail: context.context.email,
}),
metadata: {
// Add metadata only if customer exists
...(context.context?.customer?.id && {
customerId: context.context.customer.id,
has_account: context.context.customer.has_account,
}),
session_id: context.context.session_id,
},
});
const initiatePayment: Record<string, unknown> = payment as any;
return {
id: context.context.session_id,
data: initiatePayment,
};
} catch (error) {
return this.handleError(error);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I have created a custom payment provider for Mollie using the steps mentioned in the docs. I am able to initiate and complete the payment, but when the payment is complete and the webhook event
getWebhookActionAndData
is triggered, I am getting the following error. Due to this, I am unable to place an order.package.json
Errors In backend console
message: 'payment - id must be defined'
Logs from admin dash workflow
Error Logs
MolliePaymentProviderService implementation
If you need any additional data, please let me know. Any kind of help will be appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions