Welcome to

The best way to monetize

your private server

API Docs

To get started using the API, ensure that you have created your store and received your API key via the dashboard. You'll need to send this key with every request in the headers as Authorization: Bearer your_code_here. This lets us know who is using the api and thus getting you the correct information.

Api URL: https://api.runepay.app

GET /paypal/tokens

Returns an array with your paypal keys and options.

Expected output:
                    
                        {
                            "store_id": 1,
                            "production_key": "your_production_key",
                            "sandbox_key": "your_sandbox_key",
                            "test_mode": false
                            "verified_only": false,
                            "enabled": true
                        }
                    
                
Error output:
            
                { "error": "error message" }
            
        

POST /paypal/validate

Validates a paypal payment. To be used in combination with Paypal's Smart Buttons.

Post Params
Field Type Description Default
payment array Paypal order information
discount string A discount code, if one is applied
Expected output:
                    
                        {
                            "success": true,
                            "message": "cart valid!",
                        }
                    
                
Error output:
            
                { "error": "error message" }
            
        
Front-end code
                        
                            return actions.payment.get().then(async function(details) {
                                let validate = await $.post("your_backend_url/validate", details);
                                
                                // ...
                            });
                        
                    
Back-end code
                        
                            $details = $this->request->getPost();
                            $client  = new GuzzleHttp\Client();
    
                            $response = $client->request('POST', "https://api.runepay.app/paypal/validate", [
                                'headers' => [
                                    'Authorization' => "Bearer YOUR_API_TOKEN",
                                    'Accept' => 'application/json'
                                ],
                                'form_params' => [
                                    'payment'  => $details,
                                    'discount' => "discount_code_here"
                                ]
                            ]);
                    
                            $json = json_decode($response->getBody(), true);
                        
                    

POST /paypal/process

Processes and stores a paypal payment. To be used in combination with Paypal's Smart Buttons.

Post Params
Field Type Description Default
payment array Paypal order information
discount string A discount code, if one is applied
ip_address string Your customer's ip address.
Successful output:
                    
                        {
                            success: true, 
                            message: 'Thank you! Your payment has now been completed!',
                            transaction_id: "xxxxxxxxxx"
                        }
                    
                
Error output:
            
                { "error": "error message" }
            
        
Front-end code
                        
                            return actions.payment.get().then(async function(details) {
                                let validate = await $.post("your_backend_url/validate", details);
                                
                                // if a validation error occurs, check for it here and return
                                // so the user is not charged.
    
                                return actions.payment.execute().then(async function(details) {
                                    // send payment details to the backend again to be sent to the
                                    // paypal/process endpoint so they can be stored
    
                                    let exec = await $.post("your_backend_url/process", details);
    
                                    // ...
                                });
                            });
                        
                    
Back-end code
                        
                            $details = $this->request->getPost(); // also just $_POST
                            $address = $this->request->getAddress(); // get your client's ip address
    
                            $client  = new GuzzleHttp\Client();
    
                            $response = $client->request('POST', "https://api.runepay.app/paypal/process", [
                                'headers' => [
                                    'Authorization' => "Bearer YOUR_API_TOKEN",
                                    'Accept' => 'application/json'
                                ],
                                'form_params' => [
                                    'payment'    => $details,
                                    'discount'   => "discount_code_here",
                                    'ip_address' => $address
                                ]
                            ]);
                    
                            $json = json_decode($response->getBody(), true);