Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ A spend request moves through: **create** → **request approval** → **approve
**Required fields for create:** `merchant_name`, `merchant_url`, `context`, `amount`. `payment_method_id` is optional — if omitted, your default payment method will be used, or the first eligible one if no default is set.

**Constraints:** `context` must be at least 100 characters; `amount` must not exceed 500000 (cents); `currency` must be a 3-letter ISO code. The user has 10 minutes from when approval is requested to approve. Approved credentials (card or SPT) are valid for 12 hours from spend request creation.
**Test mode:** Pass `--test` to create testmode credentials (uses test card `4242424242424242`), useful for development and integration testing without real payment methods.
**Test mode:** Pass `--test` to create a testmode SpendRequest. A testmode SpendRequest will return test payment credentials (e.g test card `4000009990001984`) rather than a real payment credential. Testmode SpendRequests will not charge the underlying payment method of the SpendRequest. This is useful for development and integration testing without real payment methods.

```bash
# Update before approval
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ describe('production mode', () => {
brand: 'Visa',
exp_month: 12,
exp_year: 2027,
number: '4242424242424242',
number: '4000009990001984',
},
});

Expand All @@ -720,7 +720,7 @@ describe('production mode', () => {
expect(request.status).toBe('approved');
const card = request.card as Record<string, unknown>;
expect(card.brand).toBe('Visa');
expect(card.number).toBe('4242424242424242');
expect(card.number).toBe('4000009990001984');
});

it('returns card with billing_address and valid_until when present', async () => {
Expand All @@ -732,7 +732,7 @@ describe('production mode', () => {
brand: 'Visa',
exp_month: 12,
exp_year: 2027,
number: '4242424242424242',
number: '4000009990001984',
cvc: '123',
billing_address: {
name: 'Jane Doe',
Expand All @@ -759,7 +759,7 @@ describe('production mode', () => {
const request = output[0];
expect(request.status).toBe('approved');
const card = request.card as Record<string, unknown>;
expect(card.number).toBe('4242424242424242');
expect(card.number).toBe('4000009990001984');
expect(card.valid_until).toBe('2025-06-15T06:13:20Z');
const billingAddress = card.billing_address as Record<string, unknown>;
expect(billingAddress.name).toBe('Jane Doe');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('spend-request', () => {
const request = makeSpendRequest({
card: {
id: 'card_1',
number: '4242424242424242',
number: '4000009990001984',
brand: 'visa',
exp_month: 12,
exp_year: 2030,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('writeCredentialFile', () => {

it('writes JSON file with 0600 permissions', async () => {
const filePath = path.join(tmpDir, 'card.json');
const data = { number: '4242424242424242', cvc: '123' };
const data = { number: '4000009990001984', cvc: '123' };
const result = await writeCredentialFile(filePath, data, false);
expect(result).toBe(filePath);
const contents = JSON.parse(await fs.readFile(filePath, 'utf-8'));
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/resources/__tests__/spend-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ describe('SpendRequestResource', () => {
brand: 'Visa',
exp_month: 12,
exp_year: 2027,
number: '4242424242424242',
number: '4000009990001984',
},
};
mockFetchResponse(200, approvedResponse);
Expand All @@ -376,7 +376,7 @@ describe('SpendRequestResource', () => {
brand: 'Visa',
exp_month: 12,
exp_year: 2027,
number: '4242424242424242',
number: '4000009990001984',
});
});

Expand Down
Loading