[#1117] Custom payment processor: return_url and cancel_url

Migrated from Redmine #1117 | Author: Thomas Luzat
Status: Feedback | Priority: Normal | Created: 2023-10-09


For a custom payment process, the payment form callback receives return_url and cancel_url.

I am unhappy about how the redirects act, though. For cancelling, I redirect the user to the cancel_url.For example, when invoking the cancel_url:

Location: https://app.sbpay.me/cancel/.../custom/order/.../

This redirects to additional pages in this order:
/return/…/custom/order/…/…
/v2/ext/invoice-payment/cancel/system/custom/invoice_id/{orderid}?sbpay_order_id={invoice order id}
/v2/#invoice/pay/{orderid}/return/1

The last page also shows a gives a 404 message (but actually switches to /v2/#error/e403 <=) after getting a 403 from:

/v2/ext/invoice/details/id/{orderid}

Which isn’t surprising, because the order has been removed at this point…? My questions:

  1. As a workaround, can I redirect the user to a custom cancel page instead and follow the redirects server-side to complete cancellation in background?
  2. Can I specify a different target apart from /v2/#invoice/pay/{orderid}/return/1 for the user in another way?
  3. Should I manually try to DELETE the order or will following the cancel_url do that, too?

Similar for the success_url: Is Can I use the same workaround, just return the user to https://custom-domain/thankyou and invoke success_url myself?

Thank you!

Dmytro Bondarev wrote:

Hi,

Seems you are getting 403 because you opened final page with logged out client. Of course we will not show personal information just by id of order. We do not remove order.

  1. As a workaround, can I redirect the user to a custom cancel page instead and follow the redirects server-side to complete cancellation in background?
    Yes, of course you can do this.
  1. Can I specify a different target apart from /v2/#invoice/pay/{orderid}/return/1 for the user in another way?
    Unfortunately no.
  1. Should I manually try to DELETE the order or will following the cancel_url do that, too?
    Following cancel_url will do that

Similar for the success_url: Is Can I use the same workaround, just return the user to https://custom-domain/thankyou and invoke success_url myself?
Yes you can do this. Just make sure that you call API to confirm payment.

Thomas Luzat wrote:

Dmytro Bondarev wrote:

Similar for the success_url: Is Can I use the same workaround, just return the user to https://custom-domain/thankyou and invoke success_url myself?
Yes you can do this. Just make sure that you call API to confirm payment.

How do I manually confirm the payment? Currently after a successful payment I am using:

a) the SBPay.me API with a POST to /api/order/…/approve
b) redirect to return_url

What actions can I use to replace b)?
REST API with PUT /admin/invoices/{id}/accept-payment and { payment_processor: ‘custom’ }?

Is that the same as JSONRpc’s confirmInvoice?

Thank you, I’m nearing completion of my implementation.

Dmytro Bondarev wrote:

Hi,

On b) you can just redirect user to your page. No further actions required.