torque-checkout 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,56 @@ pnpm add torque-checkout
|
|
|
53
53
|
|
|
54
54
|
## Quick Start
|
|
55
55
|
|
|
56
|
+
### Get Checkout Working in 3 Steps
|
|
57
|
+
|
|
58
|
+
**1. Install & Get Credentials**
|
|
59
|
+
```bash
|
|
60
|
+
npm install torque-checkout
|
|
61
|
+
# or
|
|
62
|
+
yarn add torque-checkout
|
|
63
|
+
# or
|
|
64
|
+
pnpm add torque-checkout
|
|
65
|
+
```
|
|
66
|
+
- Visit https://app.torque.fi/business/settings
|
|
67
|
+
- Connect wallet, complete profile, set payment wallet
|
|
68
|
+
- Copy Business ID and API Key
|
|
69
|
+
|
|
70
|
+
**2. Add Environment Variables**
|
|
71
|
+
Create `.env.local`:
|
|
72
|
+
```env
|
|
73
|
+
TORQUE_BUSINESS_ID=your_business_id
|
|
74
|
+
TORQUE_API_KEY=your_api_key
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**3. Add Checkout Button**
|
|
78
|
+
```tsx
|
|
79
|
+
'use client'
|
|
80
|
+
import { useTorqueCheckout } from 'torque-checkout/react'
|
|
81
|
+
|
|
82
|
+
export default function CheckoutButton() {
|
|
83
|
+
const { generateProductCheckout, isLoading } = useTorqueCheckout({
|
|
84
|
+
autoRedirect: true
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<button
|
|
89
|
+
onClick={() => generateProductCheckout('prod_123', 1, {
|
|
90
|
+
email: 'customer@example.com'
|
|
91
|
+
})}
|
|
92
|
+
disabled={isLoading}
|
|
93
|
+
>
|
|
94
|
+
{isLoading ? 'Loading...' : 'Buy Now'}
|
|
95
|
+
</button>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Done!** Customer clicks → Redirects to checkout → Payment goes to your wallet.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Detailed Setup
|
|
105
|
+
|
|
56
106
|
### Step 1: Get Your API Credentials
|
|
57
107
|
|
|
58
108
|
1. **Visit [Torque Business Dashboard](https://app.torque.fi/business/settings)**
|