Webpay Plus is a common card checkout in Chile, run by Transbank. The flow is simple for one shop and needs care when many tenants share one codebase.
The flow
- Create a transaction with an amount, order ID and return URL. Transbank gives you a token and a URL.
- Send the customer to that URL with the token.
- When they return, commit the transaction with the token and read the response.
- Mark the order paid only if the committed result says it was approved.
Multi-tenant specifics
- Keep each tenant's commerce code and API key in encrypted storage, never in shared config.
- Build the return URL from the tenant's own domain so customers land back on the right site.
- Store the token against the order so a return can be matched to a tenant and an order.
- Use the integration environment for tests and switch credentials per tenant when going live.
Edge cases
- The customer closes the tab after paying: provide a way to look up the transaction later.
- The customer cancels or the payment times out: the return arrives without a successful result.
- The same return URL is opened twice.
Always follow Transbank's current developer documentation for field names and limits, since they change between SDK versions.
