stripe-perl
stripe-perl copied to clipboard
create metadata TypeConstraint
~$ perl -Mstrict -Mwarnings -mNet::Stripe -e 'my $stripe = Net::Stripe->new(api_key => $ENV{STRIPE_API_KEY});
my $source = $stripe->create_source(
type=> "card",
token=> "tok_visa",
metadata => {
somecardmetadata => "testing, testing, 1-2-3",
nested=> {
nested_key => "nested_value"
},
}
);'
produces:
{
"error": {
"message": "Invalid val: {:nested_key=\u003E\"nested_value\"} must be a string under 500 characters",
"param": "metadata",
"type": "invalid_request_error"
}
}
i was testing for, and expected, an error for the nested value, but the information about the 500 character limit is a bonus.
i know that we can restrict to HashRef[Str]
, but i am not sure if we can restrict the Str
to 500 characters using native Moose::Util::TypeConstraints
parameters.
in the interim, we can simply update all metadata to Maybe[HashRef[Str]