You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PayPal Payflow Pro API提交含引号字段报错问题咨询

PayPal Payflow Pro API: Quotation Marks in Parameter Values Trigger Validation Error

I'm submitting form data via HTTP POST to the https://pilot-payflowpro.paypal.com API, formatting parameters into a requestString joined with & (using application/x-www-form-urlencoded content type). When parameter values contain quotation characters like single quotes or " (e.g., the value "Les Clefs d Or Fund"), I get this error:

PayPal. Some required information is missing or incorrect. Please correct the fields below and try again

Here's the relevant TypeScript code snippet:

public async sendPayPalRequest(
 donationInfo: DonationInfoModel,
): Promise<string> {
 const templateString = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 const transactionDetails: IPayPalTransactionInfo = {
 // ... other properties
 currency: 'USD',
 comment1: StringHelper.replaceQuotationWithBacktick(donationInfo.fundName),
 // ... other properties
 };
 // ... additional setup logic
 const requestParameters = [];
 for (const key in transactionDetails) {
 if (transactionDetails.hasOwnProperty(key)) {
 requestParameters.push(
 `${key.toUpperCase()}[${transactionDetails[key].length}]=${transactionDetails[key]}`,
 );
 }
 }
 const requestString = requestParameters.join('&');
 const response = await axios.post(process.env.PAYPAL_TRANSACTION_URL, requestString, {
 headers: {
 'content-type': 'application/x-www-form-urlencoded',
 },
 });
 return response.data;
}

Right now, I've found that replacing quotes with &quot;&quot; or &quot;^&quot; lets the payment request go through successfully. But I'm wondering if other developers have faced this issue and found a more robust, standardized solution?

内容的提问来源于stack exchange,提问作者Gregory Sidh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 23:32:27