SparkPay OpenAPI Docs
English
  • English
  • 简体中文
English
  • English
  • 简体中文
  1. Integration Example
  • Product Introduction
  • Quick Guide
    • Integration Preparation
    • Interface Signature Description
  • Must-Read for Integration
    • Interface Rules
    • Asynchronous Notification
    • Interface Error Codes
    • Network and Currency
  • Integration Scenarios
    • Payment
    • Close Order
  • API List
    • Payment Order Creation
      POST
    • Payment Order Query
      GET
    • Payment Order Closure
      POST
    • Payment Order Creation(Pro Edition)
      POST
    • Payment Order Query(Pro Edition)
      GET
  • Frequently Asked Questions
    • Notification Related Issues
    • Redirect Failure Issues
    • Interface Error Issues
    • Test Token Acquisition/Test Network Connection
  • Integration Example
    • Interface Signature Example - PHP
    • Interface Signature Example - Postman
  • Version Notes
    • Version Notes
  1. Integration Example

Interface Signature Example - Postman

Postman Example#

Postman is a popular tool for API development and testing, allowing developers to design, test, and document APIs. It provides a user-friendly graphical interface for sending HTTP requests to APIs.
If you haven't installed Postman yet, you can download it for free from the Postman website: https://www.postman.com/
Tip: This example requires a basic understanding of Postman.

Importing External Libraries#

Since the signing algorithm uses SHA256withRSA, which is not part of the built-in libraries in the Postman sandbox environment, we need to import an external library.
External library link: https://joolfe.github.io/postman-util-lib/#postman-collection
Download the JSON files from https://github.com/joolfe/postman-util-lib/tree/master/postman
Drag and drop the downloaded JSON file into Postman.
import_json.png
Click on the Lib install request to send it.
install_lib.png
After a successful send, the RSA external library will be installed in Postman.

Setting Headers#

Under the Headers tab, add the following key-value pair:
Sparkpay-App-Id
set_header.png

Adding Body#

This typically applies to POST requests.
If your request requires a body, you can add it under the Body tab.
Select raw and JSON from the dropdown menu.
Input your request body in JSON format.
add_body.png

Setting Pre-request Scripts#

Used to generate the required signature (SPARKPAY-SIGNATURE), timestamp (SPARKPAY-TIMESTAMP), and nonce (SPARKPAY-NONCE).
In the Pre-request Script tab, insert a script that corresponds to the request type.
Edit the key as needed. The pre-request script below retrieves the private key using the private_key variable.
GET/POST request
pre_request.png

Sending the Open API Request#

send_request.png
Modified at 2024-09-12 06:21:20
Previous
Interface Signature Example - PHP
Next
Version Notes
Built with