---
url: /apidocs/payment.md
---
## Payment API

| Endpoint | Method | Description |
|-----|-----|-----|
| [/api/v0/rpc/payment.createStripeCheckoutSession](#create-stripe-checkout-session) | jsonRpc | Create stripe checkout session |
| [payment:validateAppStore](#validate-app-store-payment-receipt) | websocket | Validate App Store payment receipt |
| [payment:getBraintreeClientToken](#get-client-token-for-braintree-payment-provider) | websocket | Get client token for Braintree payment provider |
| [payment:processBraintreePayment](#process-braintree-payment) | websocket | Process Braintree payment |
| [payment:cancelBraintreeSubscription](#cancel-braintree-subscription) | websocket | Cancel Braintree subscription |
| [payment:getBraintreeSubscriptions](#get-braintree-active-subscriptions) | websocket | Get Braintree active subscriptions |
| [payment:createStripeCheckoutSession](#create-stripe-checkout-session) | websocket | Create Stripe checkout session |

### Create stripe checkout session

**Method:** jsonRpc

**HTTP Method:** POST

**Path:** /api/v0/rpc/payment.createStripeCheckoutSession

**Description:** Server creates checkout session and returns url to a Stripe-hosted payment page. Ref: https://stripe.com/docs/payments/checkout/how-checkout-works

**Headers:**

X-Session-Id: sessionToken

X-Network-Id: networkId

**Request:**

**Response:**

### Validate App Store payment receipt

**Method:** websocket

**Endpoint:** payment:validateAppStore

**Request:**

**Response:**

### Get client token for Braintree payment provider

**Method:** websocket

**Endpoint:** payment:getBraintreeClientToken

**Description:** Client should request client token from Valuverse API server and then initiate Braintree sdk using that client token. Ref : https://developers.braintreepayments.com/start/hello-client/javascript/v2#get-a-client-token

**Request:**

**Response:**

### Process Braintree payment

**Method:** websocket

**Endpoint:** payment:processBraintreePayment

**Description:** After sending payment information to Braintree server, client get response with "payment method nonce" which need to be submitted to Valuverse API server. Ref: https://developers.braintreepayments.com/start/hello-client/javascript/v2#send-payment-method-nonce-to-server

Product could be one of the actions (with `buying` type) fetched from `balance:getTokenAction` endpoint.

Also, product could be `buying_increase_balance` in order to replenish balance by custom amount of money.

**Request:**

**Response:**

### Cancel Braintree subscription

**Method:** websocket

**Endpoint:** payment:cancelBraintreeSubscription

**Request:**

**Response:**

### Get Braintree active subscriptions

**Method:** websocket

**Endpoint:** payment:getBraintreeSubscriptions

**Request:**

**Response:**

### Create Stripe checkout session

**Method:** websocket

**Endpoint:** payment:createStripeCheckoutSession

**Description:** Server creates checkout session and returns url to a Stripe-hosted payment page. Ref: https://stripe.com/docs/payments/checkout/how-checkout-works

**Request:**

**Response:**
