Purchasely / Purchasely-Firebase-Extension

Apache License 2.0
5 stars 1 forks source link

STRIPE enum value not taken into account #96

Closed ThomasEcalle closed 1 year ago

ThomasEcalle commented 1 year ago

Hi !

I am currently trying to add a Stripe to Purchasely integration for one of our customers. Here is the Purchasely documentation : https://docs.purchasely.com/quick-start-1/stripe-beta

I succeeded to link Stripe and Purchasely but there is an error when it comes to Purchasely notifying the Purchasely Cloud Function.

From what I can see in the Purchasely logs, I think that the error is simply that the cloud function do not take into account the fact that a payment may have been done by Stripe.

Here is the payload sent from Purchasely to Purchasely Extension :

{
  "plan": "monthly_7daystrial",
  "store": "STRIPE",
  "product": "20230105",
  "user_id": "2JPLDluC5yR5GP52MrPqC65stCH2",
  "event_id": "e101f0f4-03a6-4416-a2d5-17bfe7e0f16b",
  "event_name": "ACTIVATE",
  "offer_type": "NONE",
  "api_version": 3,
  "environment": "SANDBOX",
  "purchased_at": "2023-09-04T13:54:06.000Z",
  "purchase_type": "RENEWING_SUBSCRIPTION",
  "store_country": "FR",
  "next_renewal_at": "2023-10-04T13:54:06.000Z",
  "purchased_at_ms": 1693835646000,
  "event_created_at": "2023-09-04T13:54:13.772Z",
  "is_family_shared": false,
  "store_product_id": "price_1NWKxUJJc3Fp2uHM5jzLdYjh",
  "customer_currency": "EUR",
  "plan_price_in_eur": 9.9,
  "next_renewal_at_ms": 1696427646000,
  "event_created_at_ms": 1693835653772,
  "store_app_bundle_id": "acct_1Ikn93JJc3Fp2uHM",
  "subscription_status": "AUTO_RENEWING",
  "store_transaction_id": "sub_1NmdEAJJc3Fp2uHMsYC5Yl4J-1693835646",
  "original_purchased_at": "2023-09-04T13:54:06.000Z",
  "original_purchased_at_ms": 1693835646000,
  "cumulated_revenues_in_eur": 9.19,
  "effective_next_renewal_at": "2023-10-04T13:54:06.000Z",
  "purchasely_subscription_id": "subs_EKUKtcY5i40Km0G1IvEdeAK9jj6fBaBy",
  "effective_next_renewal_at_ms": 1696427646000,
  "store_original_transaction_id": "sub_1NmdEAJJc3Fp2uHMsYC5Yl4J",
  "plan_price_in_customer_currency": 9.9
}

And here is the response:

{
  "message": "400 Bad Request",
  "headers": {
    "date": "Mon, 04 Sep 2023 14:14:38 GMT",
    "etag": "W/\"100-mSDl6m5T0DCEzPYFqU6awQOvQck\"",
    "server": "Google Frontend",
    "alt_svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
    "content_type": "application/json; charset=utf-8",
    "content_length": "256",
    "function_execution_id": "4dlax5nsmdxu",
    "x_cloud_trace_context": "1cef8f09c09c4f00405e7804e91cab7e;o=1"
  },
  "body": {
    "errors": [
      {
        "params": {
          "allowedValues": [
            "AMAZON_APP_STORE",
            "APPLE_APP_STORE",
            "GOOGLE_PLAY_STORE",
            "HUAWEI_APP_GALLERY"
          ]
        },
        "keyword": "enum",
        "message": "must be equal to one of the allowed values",
        "schemaPath": "#/properties/store/enum",
        "instancePath": "/store"
      }
    ]
  }
}

I know that the Stripe to Purchasely integration is flagged as Beta so maybe it is attended that Cloud Function does not support it yet ? If so, it is not a problem, I'll tell my customer that it is not ready yet.

Thanks in advance for your help and your time :)

Have a good day!

ste26054 commented 1 year ago

Hi Thomas,

Thanks for highlighting this issue, indeed we did not add Stripe yet, we plan to do it by the end of the week!

Thanks!

ThomasEcalle commented 1 year ago

Hi @ste26054,

Awesome news :)

Thanks for your responsiveness

ste26054 commented 1 year ago

Hello @ThomasEcalle, a new release 1.0.8 has been made, Webhooks about Stripe store should now work properly!

ThomasEcalle commented 1 year ago

Hello @ste26054,

Sorry for the delay, It took us a while to get back on track for that subject. I can confirm you that it works now like a charm with a platform: WEB value for Stripe purchases!

Thank you for your time and your reactivity :)