Skip to content

🀑 A Provider for FakerPHP that Generates Fake but Structurally Correct IDs for Stripe API Resources.

License

Notifications You must be signed in to change notification settings

JonPurvis/faker-stripe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

61 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FakerPHP Stripe ID Provider Banner

FakerPHP Stripe ID Provider

GitHub Workflow Status GitHub last commit Packagist PHP Version GitHub issues GitHub Packagist Downloads

πŸ‘‹ Introduction

This package allows FakerPHP to generate fake IDs which have the same structure you can expect to be returned from Stripe. The wonderful Pest is used to run tests contained within this package, which requires a minimum PHP Version of 8.1.

✨Features

This package can currently generate fake IDs for the following Stripe resources. To avoid any confusion, the names of resources should match what's in this package.

Core Resources

API Resource Method Example
Balance Transactions stripeCoreBalanceTransactionId() txn_na40ulkbDvvegzALfY8w61udH
Charges stripeCoreChargeId() ch_Dxy18EPyj6XXvqQiqApPQ8dA
Customers stripeCoreCustomerId() cus_uW8qUwsTwKKtY3
Disputes stripeCoreDisputeId() dp_e3ZeEytdlpOxMtRg9M88RMcq
Events stripeCoreEventId() evt_diyd59RDTVw8ZxrnkOt62mFS
Files stripeCoreFileId() file_qrbRTo7XbytwvE6w3SQU8QXK
File Links stripeCoreFileLinkId() link_Z5Tesn6zQYYdov5R3bCblM8A
Mandates stripeCoreMandateId() mandate_S4EbkGH8MFAOWUXivQqcV7wx
PaymentIntents stripeCorePaymentIntentId() pi_KiAjc3WFzvswIhq8IkCLXNBW
PaymentIntents stripeCorePaymentIntentClientSecret() pi_rZh1PKbBkmMFkHve9GKRKyg4_secret_dr3lRVfoKD8ew3BUmYZYuVONV
SetupAttempts stripeCoreSetupAttemptId() setatt_JBHfYghz8HiScAnOcOKin75X
SetupIntents stripeCoreSetupIntentId() seti_yeYZcpT970pn6sBXlAkj8AbK
SetupIntents stripeCoreSetupIntentClientSecret() seti_xFyqGss1WNuKVCKf1KnXfD3b_secret_Yy5L7jzP4RuoQrCiIBqXn9FWuSvX3z6
Payouts stripeCorePayoutId() po_YqFWOxztWRuLCJezThbHktTP
Refunds stripeCoreRefundId() re_3BebPOs89OAgEtXAOG0c1eF4
Confirmation Tokens stripeCoreConfirmationTokenId() ctoken_UDlKXzYnsCqEJvomcWWqCnTF
Card Tokens stripeCoreTokenId() tok_q1KiYddcC48Tqney3T8Vnkzu
Bank Account Tokens stripeCoreBankAccountTokenId() btok_8RnxS6Y358qBuRRYS4el8LEo
PII Tokens stripeCorePersonallyIdentifiableInformationTokenId() pii_uCbQpWwZu3tJEUm18GiQsKAa
Account Tokens stripeCoreAccountTokenId() ct_XPKqNZwOTjWJatx4A5zW2Myh
Person Tokens stripeCorePersonTokenId() cpt_MtqTlVzM2qmAIv0KhZJ0qV4g
CVC Update Tokens stripeCoreCvcUpdateTokenId() cvctok_wWV1bniJ16gsBjJlIMrN8T87

Payment Methods

API Resource Method Example
Payment Methods stripePaymentMethodId() pm_jkztRiUi5yqTNqHJTzTAVolI
Payment Method Configurations stripePaymentMethodConfigurationId() pmc_BS6va641BwHZCexJscZ9LNH8
Payment Method Domains stripePaymentMethodDomainId() pmd_FcObWHJ3gtwujiuUhVhWSe2c
Bank Accounts stripePaymentMethodBankAccountId() ba_gkcmh6gu31nALx6PJDJckqPn
Cash Balance stripeCashBalanceTransactionId() ccsbtxn_6sKoup9yicpuPC7MykObBsjq
Cards stripePaymentMethodCardId() card_A56nkfbrHtdQ7bv8I9eeQOtW

Products

API Resource Method Example
Products stripeProductId() prod_Kp7fBKUx6qs3FC
Prices stripeProductPriceId() price_YhlhAgy0lHbLcOWwFZ596x1S
Promotion Codes stripeProductPromotionCodeId() promo_7ADzsJ6WuQIsKsIj4T4MTeIX
Discounts stripeProductDiscountId() di_DleWj1FqYhsriqRSaQr6jCgs
Tax Codes stripeProductTaxCodeId() txcd_90766505
Tax Rates stripeProductTaxRateId() txr_nNePe3bTkOwlrAbsAxpXzWXy
Shipping Rates stripeProductShippingRateId() shr_Sg2ZpoUCsfdAujoCc8U8MDba

Checkout

API Resource Method Example
Checkout Sessions stripeCheckoutSessionId() cs_A1caKuWyEPOrovEkpYJLfId5uOpWzynW8ZunRYnA0J9RsPzdM6YeBfDG03

Payment Links

API Resource Method Example
Payment Links stripePaymentLinkId() plink_L85n1vZMv4QS0aYwj11TKjTy

Billing

API Resource Method Example
Credit Notes stripeBillingCreditNoteId() cn_37b9KW8lODWCDSilck1hs0on
Credit Note Line Items stripeBillingCreditNoteLineItemId() il_75E91IzYCJaaSbESOZl5GQiF
Customer Balance Transactions stripeBillingCustomerBalanceTransactionId() cbtxn_SboO9vmMCUoTg6iGGdsOQ18R
Customer Portal stripeBillingCustomerPortalId() bps_HFXl8fnSxXjVUvepP0g7cfEH
Customer Portal Configuration stripeBillingCustomerPortalConfigurationId() bpc_sfteIfmkKXSNTxL7nA5dNKVS
Customer Tax IDs stripeBillingCustomerTaxIdId() txi_Vs7BSOcldH5QIN35U8lSlJuc
Invoices stripeBillingInvoiceId() in_pBNUeaVUmJ8I44Fx1OajNLQn
Invoice Items stripeBillingInvoiceItemId() ii_gOWpZpoGoMOE5IYVS86mmGXS
Invoice Line Item stripeBillingInvoiceLineItemId() il_tmp_lZHqliBZKLzgXuBajqYaAhxz
Alerts stripeBillingAlertId() alrt_39061
Meters stripeBillingMeterId() mtr_53464
Meter Event Summary stripeBillingMeterEventSummaryId() mtrusg_Be99DBj9c2jnNh5IxKt2bULP2Mb36xnO29OpHiVsfIeuyyI3OGvdtem4qLZ5e0O3ZB0cT93uhqpQZWJdNtYNmOERzX7AOan9OHu373TqGQoVYVBtzghvVp0oMclD2iZfnGYdeePNUvi5gKtsE36tuhev4h62i79IM8uWTdS0U77j4cz0DDOMZCcvX
Plans stripeBillingPlanId() price_9wWZ7dtmQSWvQDhFBJB49sv8
Quotes stripeBillingQuoteId() qt_qrx3tn3rnQ1USENFK1gJcXLv
Subscriptions stripeBillingSubscriptionId() sub_wMwsJiaZpdRfrF7WXkP0ibmc
Subscription Items stripeBillingSubscriptionItemId() si_3OdBLaD7p37H2A
Subscription Schedules stripeBillingSubscriptionScheduleId() sub_sched_OnyC6GSR3kjse08ehVNsB5U0
Test Clocks stripeBillingTestClockId() clock_6QR6dCPpUhhBg81wmyFF4VtJ
Usage Records stripeBillingUsageRecordId() mbur_ppVgDLt5HcG8zP48Grk7NZfP

Connect

API Resource Method Example
Accounts stripeConnectAccountId() acct_l8cMrvSDcUT4qP2h
Application Fees stripeConnectApplicationFeeId() fee_ITNGc4r7B4QMjtOjsLr1GA2U
Application Fee Refunds stripeConnectApplicationFeeRefundId() fr_XxY71TOJinzdNkmEQUVtlUGk
Capabilities stripeConnectCapabilityId() acap_gettfmKTrHMdUQgppBj8BJ6F
External Accounts stripeConnectExternalAccountId() ba_j8048CaKvbk1ie7lfxyzXF19
Persons stripeConnectPersonId() person_cNquFb7JU2nVsfIlprJHqIc1
Top-ups stripeConnectTopUpId() tu_kdxjWmOqbz9J5rMdnibcnr37
Transfers stripeConnectTransferId() tr_1gClurOotKNBjvk7ktS3JHxo
Transfer Reversals stripeConnectTransferReversalId() trr_LWr56oP4aoPIjVeXGOiFOJ6f
Secret Management stripeConnectSecretManagementId() appsecret_QjQnyoan5rtIYdHSokfut7VD

Fraud

API Resource Method Example
Early Fraud Warning stripeFraudEarlyFraudWarningId() issfr_NDwczkwka50cAHRFVfnbQP30
Reviews stripeFraudReviewId() prv_Zlx9K6ixTcigHUnOdpxqCjOO
Value Lists stripeFraudValueListId() rsl_C8PVL4lNS75t4PWEscJUXEkm
Value List Items stripeFraudValueListItemId() rsli_QQdPv6uWYm7nZUlX3g65TfGV

Issuing

API Resource Method Example
Authorizations stripeIssuingAuthorizationId() iauth_GyuotdxkKEHCNNYHohzBBuBh
Cardholders stripeIssuingCardholderId() ich_EyqQ6EcYkhzgyrGEQSCY68EB
Cards stripeIssuingCardId() ic_IsXAmEVzInXUPtq4uttDZ2g2
Disputes stripeIssuingDisputeId() idp_lXR4WsU6fhdpErzWVNOr24Ux
Personalization Designs stripeIssuingPersonalizationDesignsId() ipcd_ulVGQxe21jR4vx
Physical Bundles stripeIssuingPhysicalBundlesId() ics_Kd7CQOUvHjJelX
Tokens stripeIssuingTokenId() intok_HMkTW4FnWckzqqNGGFJP4I7E
Transactions stripeIssuingTransactionId() ipi_FqGAHy3JUvUsjWdqyaViRFm2

Terminal

API Resource Method Example
Locations stripeTerminalLocationId() tml_UntmyAU2XPdrxOznzLeRFOue
Readers stripeTerminalReaderId() tmr_2j8WBisfMEwMBNtLJEJ7uLOe
Hardware Orders stripeTerminalHardwareOrderId() thor_BgOkryA2RaqfMCzMomo4VDQ5
Hardware Products stripeTerminalHardwareProductId() thpr_GgSNDKrG2YURmV
Hardware SKUs stripeTerminalHardwareSkuId() thsku_46eIJkxj8F6Dfb
Hardware Shipping Methods stripeTerminalHardwareShippingMethodId() thsm_HJclEgx3fzfYd5
Configurations stripeTerminalConfigurationId() tmc_L7yWqYiNsihDrn

Treasury

API Resource Method Example
FinancialAccounts stripeTreasuryFinancialAccountId() fa_SHiUjM3c13bPdvV81YlFYwQu
Transactions stripeTreasuryTransactionId() trxn_VCKBAZWMzRUul2KHkWZjHGRt
TransactionEntries stripeTreasuryTransactionEntryId() trxne_xe1YTcpq1tmWUgzNABC8kT1S
OutboundTransfers stripeTreasuryOutboundTransferId() obt_9f5fWmY0s8Rbbfi8AoeifoRC
OutboundPayments stripeTreasuryOutboundPaymentId() obp_QOJPdQ7lbAybgALjh67lgbsA
InboundTransfers stripeTreasuryInboundTransferId() ibt_JE9DIuWCZ9bY9xGPeKYPkSI5
ReceivedCredits stripeTreasuryReceivedCreditId() rc_46y23bSUUCoMmsdv7Zvx0zYr
ReceivedDebits stripeTreasuryReceivedDebitId() rd_ylnZC0HqdHBWWouwFsQhE4GU
CreditReversals stripeTreasuryCreditReversalId() credrev_awpfYT4hppBEmsz9KPgtOYDm
DebitReversals stripeTreasuryDebitReversalId() debrev_ykpt4Mi6yZAPrm8upq3yKI5r

Entitlements

API Resource Method Example
Feature stripeEntitlementFeatureId() feat_YZF6aSsx1eTNhEYrsMw6xdUeZ6lESQjt
Product Feature stripeEntitlementProductFeatureId() prodft_8qi4lJKVjxGy8u
Active Entitlement stripeEntitlementActiveEntitlementId() ent_avB0r4MuPxc66IVgc2EF4lK50OznONZu

Sigma

API Resource Method Example
Scheduled Queries stripeSigmaScheduledQueryRunId() sqr_89Lp2zqyTtqJXSFuPn9zHIcZ

Reporting

API Resource Method Example
Report Runs stripeReportingReportRunId() frr_jJ9LNixW3dEQco0XTeX2zE1R

Financial Connections

API Resource Method Example
Accounts stripeFinancialConnectionAccountId() fca_z3JzQ1OCkYved5uWOqh3b387
Account Ownership stripeFinancialConnectionAccountOwnershipId() fcaowns_XwyWHMQFo9koh9U1TuOMW43D
Sessions stripeFinancialConnectionSessionId() fcsess_ZnomHexUQ68qiad2GWqQsvsa
Transactions stripeFinancialConnectionTransactionId() fctxn_yIcXfBzg3NSJRYHqIW5spz4v
Transaction Refresh stripeFinancialConnectionTransactionRefreshId() fctxnref_qjmwOP8D8hJlSBgSKqHsY0Bi

Tax

API Resource Method Example
Calculations stripeTaxCalculationId() taxcalc_3tXT5aZ0nMqhD0sFe8VtY8tR
Transactions stripeTaxTransactionId() tax_nnTCZZscXpM9xaJyyncMJOck
Transaction Line Items stripeTaxTransactionLineItemId() tax_li_NSTCDtCYyvp5dT

Identity

API Resource Method Example
VerificationSessions stripeIdentityVerificationSessionId() vs_j8AvYT7Tbmjz26tASmjdcyNt
Transactions stripeIdentityVerificationReportId() vr_IwuD3wV5qfD4t4fbTOzWwUm6

Crypto

API Resource Method Example
Onramp Sessions stripeCryptoOnrampSessionId() cos_wlo5PYZC2j8lFHnMaxbuFBK8
Onramp Sessions stripeCryptoOnrampSessionClientSecret() cos_Wjo3OVUVusWY54RHF6oCM0Jm_secret_Bm9iRlLbb82K19mwOxQE9jVdA0U8rMEmKO6

Climate

API Resource Method Example
Climate Order stripeClimateOrderId() climorder_zPgRtPy8onKSuWtEHoNZidD9
Climate Product stripeClimateProductId() climsku_zhSJ6n8xrB3iLS4yHNVxzpBq
Climate Supplier stripeClimateSupplierId() climsup_YKxeDsj2hhmR2cqmangtVy02

Forwarding

API Resource Method Example
Forwarding Request stripeForwardingRequestId() fwd_req_90746

Webhooks

API Resource Method Example
Webhook Endpoints stripeWebhookEndpointId() we_irKQp8JwXgUxXFefCM6zlx1R
Webhook Application stripeWebhookApplicationId() ca_Y5nYE1wwup9JPcXxQ9JaJWBRAJiFMujp

πŸ“š Usage / Examples

Pest

it('generates a well structured stripe account id', function () {
   fake()->addProvider(new Stripe(fake()));
   
   expect(fake()->stripeConnectAccountId())->toStartWith('acct_')->toHaveLength(21)->toBeString();
});

PHPUnit

public function testGeneratesWellStructuredStripeAccountId()
{
    $faker = Factory::create();
    $faker->addProvider(new Stripe($faker));

    $this->assertStringStartsWith('acct_', $faker->stripeConnectAccountId());
}

Laravel Factories

use WithFaker;

public function definition(): array
{
    $this->faker->addProvider(new Stripe($this->faker));
    
    return [
        'id' => $this->faker->stripeConnectAccountId(),
        'name' => 'John Doe',
        'email' => 'john.doe@testing.co.uk'
    ];   
}

About

🀑 A Provider for FakerPHP that Generates Fake but Structurally Correct IDs for Stripe API Resources.

Topics

Resources

License

Stars

Watchers

Forks

Languages