💰Receive Payments

Accept SMILE payments and let your players earn more when they play more

Need technical help or have feedback? Contact an engineer directly [email protected].

Front-end

1. Render SmileReceiveButton

The SmileReceiveButton will need to be rendered by the front-end client adjacent to your submit button. When users pay you with SMILE, they will be prompted to sign the blockchain transaction, all through the SDK. The callback function sends the returned signed_txn (with uuid) to your endpoint in order to verify business logic before finalizing the transaction through the backend SDK.

import { SmileReceiveButton } from 'smilecoin-sdk-react'

function myCallback(signed_txn) {
    //send signed_txn to my API with uuid
}

return (
    <SmileReceiveButton
        amount={100}: (Number: units of smile)
        platform="Test Partner" (String: platform name)
        platform_address="X" (String: platform's receive wallet)
        uuid="1" (String: platform's user identifier in their own records)
        platform_parameters={ custom_parameter_1: "x" } //(Object: will take any sensitive custom parameters you would like to encrypt and track, this will append to the provided note)
        note="testdk" (String: note describing the transaction)
        callback={myCallback} (Function: Returns signed_txn to pass to partner BE)
        env="development" (String: "development" | "production")
    />
)

Server

2. Complete transaction

Call the following method to finalize the transaction:

# Python example
receive_status = smilecoin.api.receive(<payload>)

and pass the payload outlined below. If receive_status['status']==201 and the method does not throw an exception, the transaction has been successfully completed and the funds are in your Algorand wallet. You can check receive_status['message'] for success/error messages.

Make sure you check USD-equivalent you successfully received:

# Python example
usd_equivalent_received = receive_status['usd_amount']

HTTP

Last updated