Skip to content
TrapGod
Sign in Create profile

TrapGod / Public API calls

Public API calls

The public TrapGod calls: badge, username import, create a Backout payment, and the payment ledger. Each call needs the application id and a TrapGod API key.

Public API calls

Each call is POST JSON to https://trapgod.net. Send the application id and a TrapGod API key on every call. There is no cookie session.

CallURL
Badge grant or revokehttps://trapgod.net/api/link_app_badge.php
Import usernameshttps://trapgod.net/api/link_app_import.php
Create a paymenthttps://trapgod.net/api/link_app_checkout.php
Payment ledgerhttps://trapgod.net/api/link_app_payment.php

Copy the application id from the app people page. It looks like tgaid_ plus 24 hex characters. The sample below is tgaid_0123456789abcdef01234567. Copy the TrapGod API key from that same page, or use a generated tgapp_ key. Do not send the Backout key. TrapGod already has that key on the app.

X-Trapgod-Application: tgaid_0123456789abcdef01234567
X-Trapgod-Key: TRAPGOD_KEY
Content-Type: application/json

Authorization: Bearer TRAPGOD_KEY works in place of X-Trapgod-Key. You can put application_id in the JSON instead of the header. If both are sent and they differ, the call is rejected.

Badge

Grant:

POST https://trapgod.net/api/link_app_badge.php
X-Trapgod-Application: tgaid_0123456789abcdef01234567
X-Trapgod-Key: TRAPGOD_KEY
Content-Type: application/json

{"username":"theirtrapgodname","handle":"name_on_this_app","action":"grant"}

Revoke uses the same headers and "action":"revoke". Field rules are on Badge.

Import usernames

Send up to 40 names your app already uses. TrapGod reserves each free name so a new TrapGod or OG Brokerage signup cannot claim it. The call does not create an account. The results list is one row per name.

POST https://trapgod.net/api/link_app_import.php
X-Trapgod-Application: tgaid_0123456789abcdef01234567
X-Trapgod-Key: TRAPGOD_KEY
Content-Type: application/json

{"action":"import","handles":["name_on_this_app",{"handle":"other_name","external_id":"user_42"}]}

A name that is already claimed comes back as:

{"handle":"other_name","ok":false,"status":"minted","error":"This username isn't available because it has been minted."}

A free name comes back as "status":"reserved". Send the next 40 when you have more. "action":"release" drops names this app reserved. Details are on Import.

Create a payment

This call opens a Backout checkout with the Backout key and structure saved on the app. You choose once or monthly. Pass the structure and portal from that app's Backout env packet. Those values are STRUCTURE_PUBLIC_ID and PORTAL_PUBLIC_ID. The structure id must already be saved on the TrapGod app. Leave both off to use the default structure saved on the app.

One time:

POST https://trapgod.net/api/link_app_checkout.php
X-Trapgod-Application: tgaid_0123456789abcdef01234567
X-Trapgod-Key: TRAPGOD_KEY
Content-Type: application/json

{"description":"Membership","amount_cents":500,"currency":"usd","frequency":"once","structure_public_id":"0123456789abcdef0123456789abcdef","portal_public_id":"abcdef0123456789abcdef0123456789"}

Monthly uses the same headers and "frequency":"monthly".

The response is a Backout pay link. Send the payer there. Backout charges the card. TrapGod writes a pending ledger row. Details are on Create a payment.

Ledger

When Backout marks that charge paid, failed, or refunded, post the same transaction_id as backout_ref:

POST https://trapgod.net/api/link_app_payment.php
X-Trapgod-Application: tgaid_0123456789abcdef01234567
X-Trapgod-Key: TRAPGOD_KEY
Content-Type: application/json

{"handle":"name_on_this_app","username":"theirtrapgodname","amount_cents":500,"currency":"usd","status":"paid","backout_ref":"abc123def456abc123def456abc123de"}

The same backout_ref updates one row. Details are on Ledger. Key rules are on API keys.

Create a payment