(Added: For this question, assume operations on the PayPal API are working and authenticated.)
Do PayPal Webhooks support URLs with HTTP Basic authentication credentials, so the following would create a valid webhook that used the given credentials foo:secret?
webhook_attrs = {
# NOTE the URL has HTTP Basic credentials of
# user is 'foo' and password is 'secret':
url: 'https://foo:[email protected]/paypal_events',
event_types: [
{ name: 'PAYMENT.AUTHORIZATION.CREATED' },
{ name: 'PAYMENT.AUTHORIZATION.VOIDED' }
]
}
webhook = PayPal::SDK::REST::Webhook.new(webhook_attrs)
if webhook.create && webhook.error.nil?
p "Created webhook:", webhook
else
p "Failed to create webhook:", webhook.error, webhook
end
PayPal Webhooks do not support HTTP Basic authentication (at time of writing).
Trying to create a Webhook with a URL including HTTP Basic credentials will fail with the following error:
{
"name" => "VALIDATION_ERROR",
"details" => [ { "field" => "url", "issue" => "Not a valid webhook URL" } ],
"message" => "Invalid data provided",
"information_link" => "https://developer.paypal.com/docs/api/webhooks/#errors"
}
For developers hoping to do this, a couple of suggestions:
== equality check is vulnerable to timing attacks. See https://github.com/rails/rails/blob/d66e7835bea9505f7003e5038aa19b6ea95ceea1/activesupport/lib/active_support/security_utils.rb#L22 for more on timing and length attacks.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With