Skip to main content

API Options

When creating a payment intent with the Khaime API, you can configure how the response is returned.

Default Behavior (Token)

By default, the API returns a token - an opaque string that the React SDK decodes internally.
Use this token with @khaime/react:

Redirect URL Mode

If you want a redirect URL instead of embedding the checkout, pass returnType: "url":
Then simply redirect your user:
Some payment gateways (like Startbutton) only support redirect URLs. In these cases, the API automatically returns redirectUrl regardless of your return_type setting.

When to Use Each Mode

Token Mode Benefits

  • Seamless checkout experience
  • Customer stays on your site
  • Full control over UI

URL Mode Benefits

  • No frontend code needed
  • Works with any platform
  • Hosted by Khaime (PCI compliant)

Gateway-Specific Behavior

Different gateways render differently:
Startbutton doesn’t support embedded forms. The component will show a “Continue to Payment” button that redirects the user.

Example: Handling Both Modes