# fxhash IRL Payment Integration Proposal
###### tags: `Autonomy` `fxhash`
## Direct pay to buy
Flow:
1. User pays to buy a token using {Apple,Google} Pay.
2. Autonomy server receives the payment receipts.
4. Autonomy server makes request to fxhash API with a signature
- centralized server to server call
6. fxhash mints to the destination address
```mermaid
sequenceDiagram
autonumber
participant User
participant App
participant Au Server
participant fxhash
participant Blockchain
participant Apple
User ->>+ App: Scan QR Code
App -->>- User: IRL Page
User ->>+ App: Click to buy
App -->>+ User: Prompt Apple Pay
User ->>- App: Pay
App ->>+ Apple: TX
Apple -->>- Au Server: Receipt
Au Server->>+Au Server: Prepare Mint
Au Server ->>+ fxhash: airdrop request
fxhash ->> Blockchain: mint (fxhash contract)
fxhash -->>- Au Server: ok
Au Server ->>+ Blockchain: Wait token
Blockchain -->>- Au Server: New token
Au Server -->>- App: New token
App -->>- User: New token
```
## Mint Pass
Term:
- Mint pass: A token minted by Autonomy server. A user can use the token to redeem an artwork from fxhash
Flow:
1. A user pay to by a mint pass using {Apple, Google} Pay.
2. Autonomy server mints a mint pass to the user's address
3. User signs a signature to spend the mint token
4. App requests to fxhash API with a signature
- App to fxhash direct call
6. fxhash call to burn the mint pass
- validate the signature from user
7. fxhash call to mint to the destination address
```mermaid
sequenceDiagram
autonumber
participant User
participant App
participant Au Server
participant fxhash
participant Blockchain
participant Apple
rect rgb(191, 223, 255)
note right of User : Purchase
User ->>+ App: Click to buy
App -->>+ User: Prompt Apple Pay
User ->>- App: Pay
App ->>+ Apple: TX
Apple -->>- Au Server: Receipt
Au Server->>+Au Server: Prepare Mint
Au Server ->> Blockchain: Mint a mint pass (autonomy contract)
Au Server ->>+ Blockchain: Wait confirmation
Blockchain -->>- Au Server: New token
Au Server-->>-App: New token
App -->>- User: New token
end
rect rgb(223, 191, 255)
note right of User : Redeem
User ->>+ App: Scan QR Code
App -->>- User: IRL Page
User ->>+ App: Click to Redeem
App -->>+ User: Prompt sign to burn
User ->>- App: Sign
App ->>+ fxhash: airdrop request with <br> a signature for burn instructment
fxhash ->> Blockchain: Burn mint pass (autonomy contract)
fxhash ->> Blockchain: mint (fxhash contract)
fxhash -->>- App: sent
Blockchain ->>+Au Server : Listen new token
Au Server->>-App: Push token to app
App -->>- User: New token
end
```