paypal-checkout-component for vue 保持沙盒模式

paypal-checkout-component for vue stays in sandbox mode

我正在努力上线。某些东西在沙盒模式下的工作方式很奇怪,但要么没有记录在案的切换到生产模式的方法,要么根本不起作用。

这是我得到的:

<template lang="pug">
  .paypal
    Spinner(:size="8" :thickness="3")
    PaypalButtons.buttons(
      :env="env"
      :style="style"
      :createOrder="order"
      :onInit="init"
      :onClick="validate"
      :onApprove="approve"
      :onError="error"
    )
</template>

<script>
export default {
  name: 'PayPal',
  props: {
    env: {
      type: String,
      default: 'sandbox',
      validator: value => ['sandbox', 'production'].includes(value)
    },
  },
  // ...
}
</script>

我尝试将 env 属性设置为 production 并将其完全删除。我找不到任何关于如何设置环境 的文档。我一定错过了一些基本的东西。

错误:

正如我提到的,沙盒模式工作正常,但一旦我上线(服务器端使用 PayPays 生产 URL 和客户端使用相应的 env prop),我收到以下错误

请求

URL: https://www.sandbox.paypal.com/graphql?UpdateClientConfig.

BODY:

{
  "query": "\n            mutation UpdateClientConfig(\n                $orderID : String!,\n                $fundingSource : ButtonFundingSourceType!,\n                $integrationArtifact : IntegrationArtifactType!,\n                $userExperienceFlow : UserExperienceFlowType!,\n                $productFlow : ProductFlowType!,\n                $buttonSessionID : String\n            ) {\n                updateClientConfig(\n                    token: $orderID,\n                    fundingSource: $fundingSource,\n                    integrationArtifact: $integrationArtifact,\n                    userExperienceFlow: $userExperienceFlow,\n                    productFlow: $productFlow,\n                    buttonSessionID: $buttonSessionID\n                )\n            }\n        ",
  "variables": {
    "orderID": "17884710UT885974F",
    "fundingSource": "paypal",
    "integrationArtifact": "PAYPAL_JS_SDK",
    "userExperienceFlow": "INCONTEXT",
    "productFlow": "SMART_PAYMENT_BUTTONS"
  }
}

回复:

{
    "data": {
        "updateClientConfig": null
    },
    "errors": [
        {
            "_name": "RESOURCE_NOT_FOUND",
            "checkpoints": [
                "patchClientConfig"
            ],
            "contingency": true,
            "data": {
                "message": "The specified resource does not exist."
            },
            "message": "RESOURCE_NOT_FOUND",
            "meta": {},
            "path": [
                "updateClientConfig"
            ],
            "statusCode": 200
        }
    ],
    "extensions": {
        "correlationId": "464b1d56d4581",
        "tracing": {
            "duration": 98157194,
            "endTime": "2021-09-06T16:29:45.133Z",
            "execution": {
                "resolvers": [
                    {
                        "duration": 96271082,
                        "fieldName": "updateClientConfig",
                        "parentType": "Mutation",
                        "path": [
                            "updateClientConfig"
                        ],
                        "returnType": "Boolean",
                        "startOffset": 1222180
                    }
                ]
            },
            "startTime": "2021-09-06T16:29:45.035Z",
            "version": 1
        }
    }
}

有另一个请求 https://www.sandbox.paypal.com/graphql?GetCheckoutDetails 具有类似的响应。

据我所知请求 URL 不应该是 www.sandbox.paypal...

我也有 commented on an existing issue on GitHub,但我相信这样会花很长时间才能得到答案。

您正在使用沙盒客户端 ID。

your Applications in developer.paypal.com

的“实时”选项卡中的应用更改为实时客户端 ID