Skip to main content

Payment Options

All payments on Slerp are handled via Stripe. You can view full stripe docs here

On registering Slerp wil provide you with public test keys for testing Stripe integration and live keys on go live.

Slerp offers 3 ways to pay, All support Apple Pay, Google Pay, and all card types.

Stripe's Hosted Checkout

This solution uses Stripe's hosted checkout, it's simple and quick to set up with minimal code.

Mutation

mutation WebCartPayment($cartId:ID!, $cancelUrl:String!, $mode:String, $successUrl:String!, $createCheckoutSession: Boolean = true) {
payViaWeb(cartId:$cartId, cancelUrl:$cancelUrl, mode:$mode, successUrl:$successUrl, createCheckoutSession: $createCheckoutSession) {
sessionData
}
}

Variables

{
"cartId": "c6e2f8a7-bfbb-4a10-afe3-226527bdfebf",
"cancelUrl": "YOUR_CANCEL_URL",
"successUrl": "YOUR_SUCCESS_URL"
}

The successUrl to redirect the user after a successful payment. cancelUrl for cancelled or failed payments.

Response

{
"data": {
"payViaWeb": {
"sessionData": {
"billing_address_collection": "required",
"cancel_url": "YOUR CANCEL URL",
"client_reference_id": "a7e90595-1d22-4623-9d11-f0826b5ec8b5",
"customer": null,
"customer_email": "[email protected]",
"display_items": null,
"id": "cs_test_a1DDmj10CLkVHbmPvUNJwM5I5UET1Jb6ysqg3udLjiZynYKDIO49lQu0Hv",
"livemode": false,
"locale": null,
"mode": "payment",
"object": "checkout.session",
"payment_intent": "pi_3LJM2BAuYSIPDqfI1uBVbDsC",
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"submit_type": "pay",
"subscription": null,
"success_url": "YOUR SUCCESS URL",
"url": "https://checkout.stripe.com/pay/cs_test_a1DDmj10CLkVHbmPvUNJwM5I5UET1Jb6ysqg3udLjiZynYKDIO49lQu0Hv#fidkdWxOYHwnPyd1blpxYHZxWjA0TEd2M2REcFxWTFVBdGNMbXFJRlVAXFJ1Zn9%2FMXBxcz10PEFoZE89Ml9ydzRKUXRifXRCc2N0NzNQTmpObE9VcUFcPFdMfWphTX9dQzdJYnd%2FZmdSamo8NTU3SWBLMURKMicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"
}
}
}
}

The URL field is then used to take the payment.

Android and iOS SDK

This solution uses Stripe's embedded checkout.

Mutation

mutation MobileCartPayment($cartId: ID!, $mode: String, $customerId: String) {
payViaMobile(cartId: $cartId, mode: $mode, customerId: $customerId) {
clientSecret
customerId
ephemeralKey
nextStep
transactionId
}
}

Variables

{
"cartId": "c6e2f8a7-bfbb-4a10-afe3-226527bdfebf",
"mode": "stripe",
"customerId": null
}

This mutation returns everything you need to make a payment. You can use this data to render your own stripe integration.

Sample Response

{
"data": {
"payViaMobile": {
"client_secret": "pi_3LFiZXAuYSIPDqfI1AJXUTe3_...",
"customer_id": "cus_LxdrHY...",
"ephemeral_key": "ek_test_YWNjdF8xSUJzNmFBdVlTSVBEcWZJLEh...",
"next_step": "pay",
"transaction_id": null
}
}
}

Stripe Elements

If you are using Stripe elements, you can use payForCart() to generate a clientSecret that you can pass as a parameter to your elements code.

Mutation

mutation payCart($cartId: ID!) {
payForCart(cartId: $cartId) {
clientSecret
nextStep
connectAccountId
ephemeralKey
transactionId
customerId
}
}

Variables

{
"cartId": "f2c1ed13-96fe-49ce-9e54-09ed29fc931f"
}

Sample output

{
"data": {
"payForCart": {
"clientSecret": "pi_3MCO2MAEhxVWGX7A0aSnmaw7_...",
"connectAccountId": "acct_1BF6XQ...",
"customerId": "cus_MwGZk2...",
"ephemeralKey": "ek_test_YWNjdF8xQkY2WFFBRWh4VldHWDdBLHNwOF...",
"nextStep": "pay",
"transactionId": null
}
}
}