Crafter Point Currency

Crafter Points http://help.thegamecrafter.com/article/113-crafter-points are a virtual currency system used within The Game Crafter for all kinds of things. However, they can also be used on remote sites as a way for your fans to pay for things via micro transactions. This document describes how to integrate Crafter Point Currency into your app.

Requesting Payment

To request a payment of a user, you'll need to set up a form that will post to our API, so that the user can approve the request. The form will look like this:

 <form method="POST" action="https://www.thegamecrafter.com/account/spendcp">
    <input type="hidden" name="redirect_uri" value="http://www.example.com/back/to/me">
    <input type="hidden" name="amount" value="3000">
    <input type="hidden" name="reason" value="A Big Warm Fuzzy">
    <input type="hidden" name="transaction_id" value="whatever you like">
    <input type="hidden" name="api_key_id" value="XXX-XXXX-XX-XXXX-X-XXX">
    <button>Buy a Big Warm Fuzzy for 3,000 CP</button>
 </form>
redirect_uri

A URI pointing to where you want the user to be redirected after they have approved or declined your purchase.

We will append a variable named claim_key to the URI parameters that you'll need to claim the payment.

amount

The amount of crafter points you are requesting from the user. This should be a multiple of 100 to maximize your benefit.

reason

A description of why you're charging the user some crafter points.

transaction_id

A way for you to correlate the payment request to the payment claim.

api_key_id

See APIKey.

When the user clicks this button they'll go to our site where they will approve or decline the transaction. If they decline they'll simply be redirected back to the Redirect URI. If they approve we move on to the claiming a payment phase.

Claim a Payment

If a user approves a payment, they'll be redirected back to your site via the redirect_uri you specified. We will attach a claim_key parameter to that URI. You'll use the claim_key to claim the purchase once the user is redirected back to your site. To do that you'll

 POST https://www.thegamecrafter.com/api/claim-cp-purchase
claim_key

A string passed to you after requesting payment.

If the claim key is invalid then we'll return a standard error response. But if it is valid then we'll credit your account and return a result similar to the following:

 {
    "result" : {
        "amount" : "3000",
        "transaction_id" : "whatever you like",
        "user" : {
            "id" : "xxx",
            "display_name" : "Joe Schmoe",
            "email" : "joe@schmoe.com"
        }
    }
 }

NOTE: The claim key is only valid for 1 minute after the approval.

amount

The amount of crafter points you requested.

transaction_id

A way for you to correlate the payment request to the payment claim.

user

The description of the User that approved the payment.

Payouts

After collecting all these crafter points from people, you will be able to turn them into cold hard cash, which will be paid out via our Payout system https://www.thegamecrafter.com/account/payout. The conversion ratio is 100 crafter points equals 1 US cent. Since 1 cent is the minimum conversion, you'll want to price your items in multiples of 100. So if you want to make $5 on something, then you should charge 50,000 crafter points for it.

Processing Refunds

If you need to process a refund you can use the following service.

 POST https://www.thegamecrafter.com/api/refund-cp-purchase
session_id

A Session id for your developer account.

amount

The amount of crafter points you wish to refund to the user. This should be done in multiples of 100. Anything less than 100 will subtract 1 cent from your payouts owed.

user_id

The user_id of the User that you wish to give the refund to.

reason

The reason you're processing the refund.

If successful this method will return:

 {
    "success" : 1
 }
^ Back to Top ^