This tutorial shows you how to make create a Stripe Charge based on the outcome of the execution of a Smart Clause.

No programming skills are required for this tutorial, however you will need to have or create a Stripe account, and have at least one customer for that account.

The first steps are the same as in the Hello Clause! tutorial.

You can also start from an existing fragile goods contract. If that contract has already been finalized, you will need to reopen it (look for the "Reopen Contract" button on the upper right corner where the contract state is listed).

1. Create a Fragile Goods Contract

Click the Templates tab at the top of the screen and then click on the "Fragile Goods" template, then press the "Create Contract" button.

2. Edit the Contract

Edit the name of the contract by pressing the pencil icon to the right of the default contract name ("fragile-goods").

Edit the parameters in the contract by editing the text in the contract editor. For this template you can edit the damages amount, the g-force values, the price reduction and the contract price.

3. Add the Stripe configuration

Click on the "Connections" tab for your contract and add the Stripe configuration with your user secret key and your customer id. This should looks like something as follows:

"target": "io.clause.outbound.physical.payments.stripe.StripeCreateCharge",
"transform": "{ \"$class\": \"io.clause.outbound.physical.payments.stripe.StripeCreateCharge\",\"userKey\": config.userKey,\"customerId\": config.customerId,\"amount\":response.amount * 100, \"currency\":\"USD\" }",
"config": {
"customerId": "cus_XXXXXXXXXXXXXX"

See the documentation here for more details no how to change the parameters in the configuration.

4. Finalize and Invoke the Contract

You can now add signatories, finalize the contract and invoke it as in the HelloClause! tutorial.

You should now see a new payment (in the "Payments" tab on the left) in your Stripe Dashboard each time you invoke this clause.