Collecting payment information (Hint Payments)
Use Rainforest’s Payment Component with Hint’s setup endpoint to collect cards and ACH safely.
Hint supports two primary ways to gather payment information: manual entry (card/ACH) and bank login verification. For both flows you pair Rainforest's Payment Component with Hint's Setup Intent endpoint. The component renders PCI-compliant inputs, tokenizes the data, and hands you a rainforest_id that you post to Hint.
At a high level
- Create a Setup Intent via
POST /setup.- Initialize Rainforest's component with the response (
payment_method_config_id,session_key,allowed_methods).- Confirm the Setup Intent so Rainforest returns a
rainforest_id.- Attach the payment credential to a Hint patient using
POST /payment_method.
flowchart LR
PartnerApp[Partner frontend] -->|Collects intent requirements| PartnerAPI[Partner backend]
PartnerAPI -->|POST /setup| HintSetup[Hint setup endpoint]
HintSetup -->|session_key + config| PartnerAPI
PartnerAPI -->|Embed config| RainforestUI[Rainforest component]
RainforestUI -->|Tokenized payment| RainforestAPI
RainforestAPI -->|rainforest_id| PartnerAPI
PartnerAPI -->|POST rainforest_id<br/>to /payment_method| HintProvider[Hint Provider API]
HintProvider -->|Payment method stored| PartnerAPI
classDef node fill:#ffffff,stroke:#d97706,stroke-width:1px,color:#0f172a,font-size:12px
class PartnerApp,PartnerAPI,HintSetup,RainforestUI,RainforestAPI,HintProvider node
Step 1: Create a Setup Intent
Send POST /setup with the attributes documented in paymentmethodcreatesetupintent.
accepts_bank(true|false): Toggles bank account support in the component.user_is_owner(true|false): Indicates whether the patient is filling in their own information (enables direct bank login).
The response includes payment_method_config_id, session_key, and allowed_methods. Persist them temporarily—Rainforest needs the trio to render the form and confirm the intent.
Step 2: Initialize the Rainforest component
Load Rainforest's JavaScript bundle in your experience and pass in the values returned above. Patients enter payment info directly into Rainforest's iframe, keeping sensitive data away from your infrastructure. Once the form is submitted, confirm the Setup Intent so Rainforest can collect any required authorizations and return a rainforest_id.
<!-- Staging -->
<script type="module" src="https://static.rainforestpay.com/sandbox.payment.js"></script>
<!-- Production -->
<script type="module" src="https://static.rainforestpay.com/payment.js"></script>
<rainforest-payment
session-key="RETURNED_SESSION_KEY"
payment-method-config-id="RETURNED_PAYMENT_METHOD_CONFIG_ID"
allowed-methods="RETURNED_ALLOWED_METHODS">
</rainforest-payment>Step 3: Attach the payment method to a patient
Never send raw card or bank numbers to HintAll sensitive payment data must flow directly from the user's browser to Rainforest. Hint only accepts the tokenized
rainforest_id.
Call POST /payment_method with the patient identifier and the rainforest_id returned after confirming the Setup Intent. A successful response looks like:
{
"id": "bnk-ab12C345DeF6",
"default": true,
"last_four": "4123",
"name": "Bank of America NA",
"type": "bank_account",
"bank_account": {
"id": "bnk-ab12C345DeF6",
"last_four": "4123",
"name": "Bank of America NA",
"stripe_token": null,
"type": "BankAccount"
},
"card": null
}{
"id": "card-ab12C345DeF6",
"default": false,
"last_four": "4123",
"name": "Visa",
"type": "card",
"bank_account": null,
"card": {
"id": "card-ab12C345DeF6",
"card_type": "visa",
"exp_month": 7,
"exp_year": 2017,
"last_four": "4123",
"name": "Visa",
"type": "Card"
}
}Once the payment method is stored you can assign it to memberships, issue invoices, or trigger charges immediately.
Testing cards
Use any ZIP/CVC. Expirations must be in the future.
4242 4242 4242 4242 – Visa (success)
5555 5555 5555 4444 – Mastercard debit (success)
3782 822463 10005 – American Express (success)
4000 0000 0000 0002 – Declined (card_declined)
4000 0000 0000 0127 – Declined (incorrect_cvc)
Testing bank accounts / ACH
Simulate ACH outcomes with the following routing/account pairs:
- (U.S. Bank) routing
091000022, accountAny 4–26 digits - (Wells Fargo Bank) routing
091000019, accountAny 4–26 digits - (JPMorgan Chase Bank) routing
021000021, accountAny 4–26 digits
Updated about 18 hours ago
