Get /weather with X-PAYMENT
Last updated
Last updated
The user can directly call the /weather
with a X-PAYMENT
header containing the Payment Payload encoded with base 64 (definition here: ).
To do this, the client will have to generate this kind of JSON:
In this JSON, there are two things : - Payment Payload (included as the X-PAYMENT header in base64 encoded JSON). - Inside this Payment payload, there is the payload field. This field is specific and depends on the scheme you set. For example, you can find read the exact payload specification here : .
Once you have build this JSON, use the code below to encode it and then, add it to the X-PAYMENT
header of your query.
If the payment is accepted and all the verification succeed, the query result will be displayed (in our case, it will be the weather).