No signatures found matching the expected signature for payload

Shun Yamada

I'm working on the marketplace application. When payout to a connect account from the platform, I want to update account's balance information and add receipt model on my application. But No signatures found matching the expected signature for payload error occurs and I can't get payout.paid event.

stripe.rb

StripeEvent.configure do |events|
  # The case transfer created
  events.subscribe(
    'payout.paid',
    Events::PayoutPaid.new
  )
end

apps/services/events/payout_paid.rb

class Events::PayoutPaid
  def call(event)
    source = event.data.object

    # Fetch balence information
    account = source.destination
    balance = Stripe::Balance.retrieve(
        {stripe_account: account}
      )

    @user = User.find_by({
      stripe_account_id: account
    })
    @user.balance = balance["available"][0]["amount"]
    @user.save

    # create receipt
    @receipt = Receipt.new
    @receipt.user = @user
    @receipt.amount = source.amount
    @receipt.save
  end
end

Although other stripe webhook would work.

gumlym

That is because you havent loaded the signing secrets to StripeEvent

Lest say you create 2 webhooks on the Stripe dashboard, one subscribed to invoices events, the other to customer events. You first need to copy each of the Signing secret (click on reveal) and then store them in the config/credentials.yml.enc file

First, run the command EDITOR="atom --wait" rails credentials:edit (using the editor of your choosing). Then, add the following values:

    stripe:
      development:
        secret_key: MY_SECRET_KEY
        publishable_key: MY_PUBLISHABLE_KEY
        signing_secret_customer_endpoint: MY_SIGNING_SECRET_CUSTOMERS
        signing_secrets_invoice_endpoint: MY_SIGNING_SECRET_INVOICES

Save the file. Now edit the initializer for stripeEvent. In my case, it was config/initializers/stripe.rb and add:

StripeEvent.signing_secrets = [
  Rails.application.credentials[:stripe][Rails.env.to_sym][:signing_secret_customer_endpoint],
  Rails.application.credentials[:stripe][Rails.env.to_sym][:signing_secrets_invoice_endpoint]]

Now the signing secrets are loaded and the webhooks should work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

No qualifying bean, expected single matching bean but found 2

Error warning: [deprecation] signatures in PackageInfo has been deprecated for(Signature signature:info.signatures)

No qualifying bean of type 'javax.persistence.EntityManager' available: expected single matching bean but found 2

JAVA: Stripe webhook error: No signatures found matching the expected signature for payload

Verifying signature of payload in Go

SpringFramework: expected single matching bean but found 2

Spring MVC AuthenticationManager expected single matching bean but found 4

Stripe Error: No signatures found matching the expected signature for payload

Spring with MyBatis: expected single matching bean but found 2

Expected String, found &str when matching an optional string

OpenSSL ECDSA signatures longer than expected

Error: No matching signature for operator = for argument types: STRUCT<id STRING, name STRING>, STRING. Supported signatures: ANY = ANY at [4:7]

Sklearn Preprocessing -- *** TypeError: No matching signature found

BigQuery returns No Matching Signature

Error: Expected one matching request for criteria "Match by function: ", found none

Type mismatch using trim_end_matches as closure function: expected signature ... found signature of "for<'r> ..."

Matching parameters in signature

Pearsonr: TypeError: No loop matching the specified signature and casting was found for ufunc add

Spring FactoryBean and autowiring not working : expected single matching bean but found 2

On signature matching of Standard ML

Why is a JWT signature not unique for a specific payload

Expected one matching request, found 2 requests. How do I test for 2 requests

No matching signature for operator > for argument types: STRING, INT64. Supported signatures: ANY > ANY at BigQuery

NaN replace on pandas DataFrame raises TypeError: No matching signature found

Rust Function Signature resulting in: error: expected `::`, found `,`

Signed JWT rejected: Another algorithm expected, or no matching key(s) found

Stripe: No signatures found matching the expected signature for payload using flask

Python Pandas aggregation error: "No matching signature found" when trying to calculate mode

No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive